winget-cli: Program 'winget.exe' failed to run at line 1 char 1

Brief description of your issue

Typing winget on powershell or cmd just throws error.

Steps to reproduce

Nothing special, applied to Insider program and tried install new App Manager via microsoft store.

Expected behavior

Having winget app working

Actual behavior

Typing winget returns:

Program 'winget.exe' failed to run: The system cannot find the file specified
At line:1 char:1
+ winget
+ ~~~~~~.
In riga:1 car:1
+ winget
+ ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

I then tried debugging it:

PS C:\Users\Admin>Trace-Command -Expression {winget} -Name CommandDiscovery -PSHost | out-null
DEBUG: CommandDiscovery Information: 0 : Looking up command: winget
... skipping all path discovery ...
DEBUG: CommandDiscovery Information: 0 : Command Found: path (C:\Users\Admin\AppData\Local\Microsoft\WindowsApps\winget.exe) is an application with name: winget.exe
DEBUG: CommandDiscovery Information: 0 : Looking up command: Set-StrictMode
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Set-StrictMode  Microsoft.PowerShell.Commands.SetStrictModeCommand
DEBUG: CommandDiscovery Information: 0 : Looking up command: Set-StrictMode
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Set-StrictMode  Microsoft.PowerShell.Commands.SetStrictModeCommand
DEBUG: CommandDiscovery Information: 0 : Looking up command: Set-StrictMode
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Set-StrictMode  Microsoft.PowerShell.Commands.SetStrictModeCommand
DEBUG: CommandDiscovery Information: 0 : Looking up command: Set-StrictMode
DEBUG: CommandDiscovery Information: 0 : Cmdlet found: Set-StrictMode  Microsoft.PowerShell.Commands.SetStrictModeCommand
Program 'winget.exe' failed to run: The system cannot find the file specified
At line:1 char:28
+ Trace-Command -Expression {winget} -Name CommandDiscovery -PSHost | o ...
+                            ~~~~~~.
At line:1 char:28
+ Trace-Command -Expression {winget} -Name CommandDiscovery -PSHost | o ...
+                            ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

Environment

[winget --info]
Windows Package Manager version Can't run winget do I can't say it for sure
Windows: Windows.Desktop version 10.0.19042 N/D build 19042 (if this is the value needed)
Package: Microsoft.DesktopAppInstaller version - Windows Store doesn't state the version

Any other software? WSL and hyper-v enabled

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 3
  • Comments: 15 (6 by maintainers)

Most upvoted comments

I’m getting the same error after installing the latest version from an administrative PowerShell session.

PS C:\WINDOWS\system32> add-appxpackage -Path "C:\Users\snip\Downloads\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle"   

PS C:\WINDOWS\system32> winget
Program 'winget.exe' failed to run: The file cannot be accessed by the systemAt line:1 char:1
+ winget
+ ~~~~~~.
At line:1 char:1
+ winget
+ ~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

PS C:\WINDOWS\system32> Get-AppxPackage microsoft.desktopappinstaller


Name              : Microsoft.DesktopAppInstaller
Publisher         : CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
Architecture      : X64
ResourceId        :
Version           : 1.16.12653.0
PackageFullName   : Microsoft.DesktopAppInstaller_1.16.12653.0_x64__8wekyb3d8bbwe
InstallLocation   : C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_1.16.12653.0_x64__8wekyb3d8bbwe
IsFramework       : False
PackageFamilyName : Microsoft.DesktopAppInstaller_8wekyb3d8bbwe
PublisherId       : 8wekyb3d8bbwe
IsResourcePackage : False
IsBundle          : False
IsDevelopmentMode : False
NonRemovable      : False
Dependencies      : {Microsoft.VCLibs.140.00.UWPDesktop_14.0.30035.0_x64__8wekyb3d8bbwe, Microsoft.DesktopAppInstaller_1.16.12653.0_neutral_split.scale-100_8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind     : Store
Status            : Ok

Hi, this is still happening to me. The installer from the github page says a new version is already installed, but I get exactly this error.