microsoft / microsoft/winget-cli
winget configure command fails from admin powershell with "unrecognized command". Retry works.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 26.4k
- Forks
- 1.8k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 15
Description
Brief description of your issue
Running these commands after a new install of Windows 11 OS from admin powershell 5.0.
& winget configure --enable
& winget configure --file Winget-Config.yaml
Retry works but this breaks my automation.
Configuring package Microsoft.VisualStudio.2022.Enterprise, config .\Winget-Config.yaml
Enabling configuration components. Requires store access.
██████████████████████████████ 100%
Windows Package Manager v1.10.340
Copyright (c) Microsoft Corporation. All rights reserved.
Unrecognized command: 'C:\Users\chitturs\AppData\Local\Microsoft\WindowsApps\winget.exe'
The winget command line utility enables installing applications and other packages from the command line.
usage: winget [] []
The following commands are available:
install Installs the given package
show Shows information about a package
source Manage sources of packages
search Find and show basic info of packages
list Display installed packages
upgrade Shows and performs available upgrades
uninstall Uninstalls the given package
hash Helper to hash installer files
validate Validates a manifest file
settings Open settings or set administrator settings
features Shows the status of experimental features
export Exports a list of the installed packages
import Installs all the packages in a file
pin Manage package pins
configure Configures the system into a desired state
download Downloads the installer from a given package
repair Repairs the selected package
For more details on a specific command, pass it the help argument. [-?]
The following options are available:
-v,--version Display the version of the tool
--info Display general info of the tool
-?,--help Shows help about the selected command
--wait Prompts the user to press any key before exiting
--logs,--open-logs Open the default logs location
--verbose,--verbose-logs Enables verbose logging for winget
--nowarn,--ignore-warnings Suppresses warning outputs
--disable-interactivity Disable interactive prompts
--proxy Set a proxy to use for this execution
--no-proxy Disable the use of proxy for this execution
More help can be found at: https://aka.ms/winget-command-help
What I see in the winget log
2025-04-10 15:06:28.176 [CORE] OS: Windows.Desktop v10.0.26100.3476
2025-04-10 15:06:28.176 [CORE] Command line Args: "C:\Users\chitturs\AppData\Local\MICROS~1\WINDOW~1\winget.exe" "C:\Users\chitturs\AppData\Local\Microsoft\WindowsApps\winget.exe" configure --file .\Winget-Config.yaml
2025-04-10 15:06:28.176 [CORE] Package: Microsoft.DesktopAppInstaller v1.25.340.0
2025-04-10 15:06:28.176 [CORE] IsCOMCall:0; Caller: winget-cli
2025-04-10 15:06:28.184 [CLI ] WinGet invoked with arguments: 'C:\Users\chitturs\AppData\Local\Microsoft\WindowsApps\winget.exe' 'configure' '--file' '.\Winget-Config.yaml'
2025-04-10 15:06:28.222 [CLI ] Error encountered parsing command line: Unrecognized command: 'C:\Users\chitturs\AppData\Local\Microsoft\WindowsApps\winget.exe'
Steps to reproduce
- Fresh install windows 11 OS.
- From admin poweshell run these commands:
& winget configure --enable
& winget configure --file Winget-Config.yaml
Here is the Winget-Config.yaml file
properties:
assertions:
- resource: Microsoft.Windows.Developer/OsVersion
directives:
description: Verify min OS version requirement
allowPrerelease: true
settings:
MinVersion: '10.0.22000'
resources:
- resource: Microsoft.Windows.Developer/DeveloperMode
directives:
description: Enable Developer Mode
allowPrerelease: true
settings:
Ensure: Present
- resource: Microsoft.WinGet.DSC/WinGetPackage
id: vsPackage
directives:
description: Install Visual Studio 2022 Enterprise
settings:
id: Microsoft.VisualStudio.2022.Enterprise
source: winget
- resource: Microsoft.VisualStudio.DSC/VSComponents
dependsOn:
- vsPackage
directives:
description: Install required VS workloads from vsconfig file
allowPrerelease: true
settings:
productId: Microsoft.VisualStudio.Product.Enterprise
channelId: VisualStudio.17.Release
vsConfigFile: '.\VS2022.Config'
includeRecommended: true
configurationVersion: 0.2.0
Expected behavior
Both winget command work with no errors. Help is not shown.
Actual behavior
winget configure --file fails with "unrecognized command" and help is shown.
Environment
PS C:\temp> winget --info
Windows Package Manager v1.10.340
Copyright (c) Microsoft Corporation. All rights reserved.
Windows: Windows.Desktop v10.0.26100.3476
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.25.340.0
Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User) %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User) %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root C:\Program Files\WinGet\Packages
Portable Package Root (x86) C:\Program Files (x86)\WinGet\Packages
Installer Downloads %USERPROFILE%\Downloads
Configuration Modules %LOCALAPPDATA%\Microsoft\WinGet\Configuration\Modules
Links
---------------------------------------------------------------------------
Privacy Statement https://aka.ms/winget-privacy
License Agreement https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
Admin Setting State
--------------------------------------------------
LocalManifestFiles Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride Disabled
LocalArchiveMalwareScanOverride Disabled
ProxyCommandLineOptions Disabled
DefaultProxy Disabled
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two winget configure commands from an elevated PowerShell session on a fresh Windows 11 install, then inspect the WinGet log entries showing the executable path being parsed as an argument. Done means both commands complete without reporting the executable path as an unrecognized command or displaying help.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, powershell
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100