Relevant area(s)
WinGet CLI
Relevant command(s)
winget install (winget upgrade is expected to hit the same code path.)
Brief description of your issue
When winget install is invoked from a non-elevated terminal for a package whose installer needs elevation (reproduced with Microsoft.PowerShell 7.6.0 → 7.6.1, which resolves to the x64 MSI), winget correctly requests UAC elevation, downloads and verifies the installer, then prints Starting package install... — but instead of launching the MSI, Windows pops up a shell dialog:
This file does not have an app associated with it for performing this action
(localized on zh-CN systems as: 该文件没有与之关联的应用来执行该操作)
Dismissing the dialog, winget exits with:
An unexpected error occurred while executing the command:
0x800704c7 : The operation was canceled by the user.
The user did not cancel anything — the dialog itself is the failure. The MSI is never handed to msiexec.
Reproduced on two independent Windows 11 x64 machines (not specific to a single environment).
Local file associations are correct and identical between the user and admin contexts, and double-clicking the exact downloaded MSI works — so this appears to be specific to winget's post-elevation launch path (likely the WinGet Package Manager Server COM surrogate) rather than to the user's file-association state.
Steps to reproduce
On a machine with Microsoft.PowerShell 7.6.0 installed:
- Open a non-elevated terminal (plain Windows Terminal / PowerShell 5.1 / PowerShell 7 launched without "Run as administrator").
- Run:
winget install --id Microsoft.PowerShell
- Approve the UAC prompt that appears.
- Observe:
- winget prints
Successfully verified installer hash and Starting package install...
- Windows displays a shell dialog: "This file does not have an app associated with it for performing this action".
- After the dialog is dismissed, winget exits with
0x800704C7.
Full output:
> winget install --id Microsoft.PowerShell
Found an existing package already installed. Trying to upgrade the installed package...
Found PowerShell [Microsoft.PowerShell] Version 7.6.1.0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
The installer will request to run as administrator. Expect a prompt.
An unexpected error occurred while executing the command:
0x800704c7 : The operation was canceled by the user.
Expected behavior
After UAC approval, winget should launch the downloaded MSI through msiexec exactly the same way it does when invoked from an already-elevated terminal, regardless of whether the host terminal was elevated.
Actual behavior
The post-elevation launch fails at ShellExecute with a "no app associated with this file" dialog, even though:
assoc .msi returns .msi=Msi.Package in both user and admin sessions — identical output.
ftype Msi.Package returns Msi.Package="%SystemRoot%\System32\msiexec.exe" /i "%1" %* in both user and admin sessions — identical output.
- Double-clicking the exact file that winget downloaded into its per-package temp directory (
%LOCALAPPDATA%\Temp\WinGet\Microsoft.PowerShell.7.6.1.0\PowerShell-7.6.1-win-x64.msi) from Explorer launches msiexec and shows the installer UI correctly.
- Running the same
winget install --id Microsoft.PowerShell from an elevated terminal does not trigger the dialog; msiexec is invoked normally. (A separate, unrelated MSI error 1603 then occurs due to a missing C:\Windows\Installer cache entry — that is out of scope for this report.)
- The
winget --info output is identical between the two machines used to reproduce.
Hypothesis: winget's auto-elevation path (COM surrogate / WinGet Package Manager Server) performs a ShellExecute of the installer in a context where the .msi ProgID cannot be resolved the same way a regular user-shell ShellExecute can. The misleading "canceled by the user" message comes from the user closing the Windows-generated "no associated app" dialog, not from any actual cancel action.
Environment
[winget --info]
Windows Package Manager v1.28.240
Windows: Windows.Desktop v10.0.26100.8246
System architecture: X64
Package: Microsoft.DesktopAppInstaller v1.28.240.0
Windows 11 IoT Enterprise LTSC 2024
OsVersion : 10.0.26100 (build 26100)
Architecture : x64
Package under test:
Id : Microsoft.PowerShell
Installed : 7.6.0
Target : 7.6.1
Installer used by winget: PowerShell-7.6.1-win-x64.msi
(winget show lists Installer Type: msix, but for this machine
winget actually selected the x64 MSI installer.)
Also reproduced on a second independent Windows 11 x64 machine with the same
winget / Microsoft.DesktopAppInstaller versions.
Relevant area(s)
WinGet CLI
Relevant command(s)
winget install(winget upgradeis expected to hit the same code path.)Brief description of your issue
When
winget installis invoked from a non-elevated terminal for a package whose installer needs elevation (reproduced withMicrosoft.PowerShell7.6.0 → 7.6.1, which resolves to the x64 MSI), winget correctly requests UAC elevation, downloads and verifies the installer, then printsStarting package install...— but instead of launching the MSI, Windows pops up a shell dialog:Dismissing the dialog, winget exits with:
The user did not cancel anything — the dialog itself is the failure. The MSI is never handed to
msiexec.Reproduced on two independent Windows 11 x64 machines (not specific to a single environment).
Local file associations are correct and identical between the user and admin contexts, and double-clicking the exact downloaded MSI works — so this appears to be specific to winget's post-elevation launch path (likely the
WinGet Package Manager ServerCOM surrogate) rather than to the user's file-association state.Steps to reproduce
On a machine with
Microsoft.PowerShell7.6.0 installed:Successfully verified installer hashandStarting package install...0x800704C7.Full output:
Expected behavior
After UAC approval, winget should launch the downloaded MSI through
msiexecexactly the same way it does when invoked from an already-elevated terminal, regardless of whether the host terminal was elevated.Actual behavior
The post-elevation launch fails at ShellExecute with a "no app associated with this file" dialog, even though:
assoc .msireturns.msi=Msi.Packagein both user and admin sessions — identical output.ftype Msi.PackagereturnsMsi.Package="%SystemRoot%\System32\msiexec.exe" /i "%1" %*in both user and admin sessions — identical output.%LOCALAPPDATA%\Temp\WinGet\Microsoft.PowerShell.7.6.1.0\PowerShell-7.6.1-win-x64.msi) from Explorer launchesmsiexecand shows the installer UI correctly.winget install --id Microsoft.PowerShellfrom an elevated terminal does not trigger the dialog;msiexecis invoked normally. (A separate, unrelated MSI error 1603 then occurs due to a missingC:\Windows\Installercache entry — that is out of scope for this report.)winget --infooutput is identical between the two machines used to reproduce.Hypothesis: winget's auto-elevation path (COM surrogate /
WinGet Package Manager Server) performs aShellExecuteof the installer in a context where the.msiProgID cannot be resolved the same way a regular user-shellShellExecutecan. The misleading"canceled by the user"message comes from the user closing the Windows-generated "no associated app" dialog, not from any actual cancel action.Environment