Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
raikoug opened this issue Jan 23, 2021 · 15 comments
Closed

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

raikoug opened this issue Jan 23, 2021 · 15 comments
Labels
Area-External Issue outside of winget-cli source Issue-Bug It either shouldn't be doing this or needs an investigation.
Milestone

Comments

@raikoug
Copy link

raikoug commented Jan 23, 2021

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
@ghost ghost added the Needs-Triage Issue need to be triaged label Jan 23, 2021
@denelon
Copy link
Contributor

denelon commented Jan 25, 2021

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?

@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback Issue needs attention from issue or PR author and removed Needs-Triage Issue need to be triaged labels Jan 25, 2021
@ghost ghost added the No-Recent-Activity Issue has no recent activity label Feb 1, 2021
@ghost

This comment has been minimized.

@freeone3000
Copy link

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.

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label Feb 4, 2021
@denelon denelon removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Feb 4, 2021
@denelon
Copy link
Contributor

denelon commented Apr 27, 2021

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

@denelon denelon added the Needs-Author-Feedback Issue needs attention from issue or PR author label May 6, 2021
@ghost ghost added the No-Recent-Activity Issue has no recent activity label May 14, 2021
@ghost

This comment has been minimized.

@rbeesley
Copy link

rbeesley commented May 31, 2021

@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.

@ghost ghost removed the No-Recent-Activity Issue has no recent activity label May 31, 2021
@rbeesley
Copy link

rbeesley commented May 31, 2021

And as further assistance to resolving this issue, I toggled the App Execution Alias off, then back on, and it works now. So I believe this should be considered a workaround, but it can be an issue. Other environment concerns which might be related, When I tried to promote the installation of winget, there was a pending reboot. This was also performed from a second account on my system, which while an Administrator account is not the primary account I installed Windows from.

Edit: I had Windows Terminal installed and then went to install Windows Terminal Preview. In App Execution Aliases wt.exe was expectedly linked to Windows Terminal. This was verified by showing a directory listing. I disabled the Windows Terminal alias and again showed the directory listing. wt.exe was not linked. Looking in App Execution Aliases, Windows Terminal Preview was listed as being enabled. I toggled Windows Terminal Preview off and back on, and then it showed in the directory listing. This suggests to me that this might be a Windows bug rather than something with App Installer alone. The exception that makes me think this was a second issue is that winget.exe was listed in the directory and wouldn't work, whereas in this case with two apps competing for the wt.exe shortcut, the alias itself was missing.

@denelon denelon removed the Needs-Author-Feedback Issue needs attention from issue or PR author label Jun 1, 2021
@denelon
Copy link
Contributor

denelon commented Jun 1, 2021

@rbeesley thanks for the additional context.

@denelon denelon added this to the v.Next - Windows Package Manager milestone Jun 1, 2021
@denelon denelon added the Area-External Issue outside of winget-cli source label Jun 1, 2021
@denelon
Copy link
Contributor

denelon commented Jun 1, 2021

This appears to be related to how Windows is handling some of the package registration. We will have to continue investigating this issue to see if we can identify the root cause and see if there is a fix we can make or work with another team to implement a fix.

@A9G-Data-Droid
Copy link

A9G-Data-Droid commented Jun 9, 2021

I'm linking my post over on a related issue because it seems to be relevant. It's possible that these two issues should be merged.

NOTE: It could be a permissions issue on AppInstaller.exe

@denelon denelon modified the milestones: v.Next-Client, v1.2-Client Oct 1, 2021
@denelon
Copy link
Contributor

denelon commented Oct 1, 2021

@raikoug

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

Can you confirm if this is still happening?

@denelon denelon closed this as completed Oct 1, 2021
@A9G-Data-Droid
Copy link

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

@denelon denelon reopened this Oct 1, 2021
@denelon denelon modified the milestones: v1.2-Client, v1.3-Client Jan 8, 2022
@denelon denelon modified the milestones: v1.3-Client, v1.4-Client May 31, 2022
@denelon denelon modified the milestones: v1.4-Client, v1.3-Client Jun 21, 2022
@denelon
Copy link
Contributor

denelon commented Jun 21, 2022

@denelon denelon closed this as completed Jun 21, 2022
Repository owner moved this from To Do to Done in WinGet Jun 21, 2022
@vzabawski
Copy link

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.

@A9G-Data-Droid
Copy link

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
Labels
Area-External Issue outside of winget-cli source Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
Archived in project
Development

No branches or pull requests

6 participants