Skip to content

Program 'winget.exe' failed to run at line 1 char 1 #712

Closed

Description

@raikoug

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

Activity

  1. ghost added
    Needs-Triage
    on Jan 23, 2021
  2. denelon commented on Jan 25, 2021

    @denelon
    Collaborator

    There is some calendar time on our hands currently between requesting access to the Windows Package Manager insiders program and getting the update to the "App Installer" in the store. Is this still happening? Have you been able to get the update to the App Installer?

  3. added
    Issue-Bug
    Needs-Author-Feedback
    and removed
    Needs-Triage
    on Jan 25, 2021
  4. ghost added
    No-Recent-Activity
    on Feb 1, 2021
  5. freeone3000 commented on Feb 4, 2021

    @freeone3000

    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.

  6. ghost removed
    No-Recent-Activity
    on Feb 4, 2021
  7. removed
    Needs-Author-Feedback
    on Feb 4, 2021
  8. denelon commented on Apr 27, 2021

    @denelon
    Collaborator

    Jasmine Moore (@freeone3000) have you checked to see if you have the App Execution Alias enabled for "winget"?

  9. added
    Needs-Author-Feedback
    on May 6, 2021
  10. ghost added
    No-Recent-Activity
    on May 14, 2021
  11. rbeesley commented on May 31, 2021

    @rbeesley

    Demitrius Nelon (@denelon), perhaps this is something you want to pull back into To Do?

    This is a problem I'm seeing too. I'm on 20H2 and enabled this from joining the "Windows Package Manager Insider Program." I have the same failure trying to run winget from PowerShell and in a Command Prompt I get the following results:

    C:\Users\[REDACTED]\AppData\Local\Microsoft\WindowsApps>dir
     Volume in drive C is Local Disk
     Volume Serial Number is 0000-0000
    
     Directory of C:\Users\[REDACTED]\AppData\Local\Microsoft\WindowsApps
    
    05/29/2021  04:05 PM    <DIR>          Backup
    ...
    05/21/2021  08:24 AM                 0 winget.exe
    05/26/2021  12:59 AM                 0 wt.exe
                   x File(s)              0 bytes
                   y Dir(s)  zzz,zzz,zzz,zzz bytes free
    
    C:\Users\[REDACTED]\AppData\Local\Microsoft\WindowsApps>winget.exe
    The system cannot find the file C:\Users\[REDACTED]\AppData\Local\Microsoft\WindowsApps\winget.exe.
    

    Windows Package Manager Client (winget.exe) is listed as an App Execution Alias and it is enabled. The version of App Installer installed according to Microsoft Store is version 1.11.11451.0.

  12. 10 remaining items

  13. denelon commented on Oct 1, 2021

    @denelon
    Collaborator

    Raikoug (@raikoug)

    We've published the v1.1 release candidate and updated our troubleshooting guide.

    Can you confirm if this is still happening?

  14. A9G-Data-Droid commented on Oct 1, 2021

    @A9G-Data-Droid

    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
    
  15. vzabawski commented on Nov 20, 2023

    @vzabawski

    I had the same issue and I've noticed winget works under regular user, but doesn't work under Administrator. So, running regular Terminal helped me.

  16. A9G-Data-Droid commented on Nov 20, 2023

    @A9G-Data-Droid

    I had the same issue and I've noticed winget works under regular user, but doesn't work under Administrator. So, running regular Terminal helped me.

    That's the crux: The goal of a package manager is to be able to run winget upgrade --all as admin, to update all software on the computer system. If you run as a regular user you can't update all the software. If you run as admin, it just fails.

    You can't use winget to manage software in an enterprise. If you could combine this with InTune you could manage Windows systems in a similar fashion to Linux systems. Linux had package management figured out decades ago, and it's open source. All Microsoft had to do was read the source of aptitude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ExternalIssue-Bug

    Type

    No type

    Projects

    • Status
      Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions