Winget, also known as the Windows Package Manager, is a tool that allows you to install applications and packages using Command Line Interfaces (CLIs), like Command Prompt and PowerShell. But sometimes, when you run a Winget command, you can get an error that says the CLI doesn’t recognize it. This guide shows how to get rid of this annoying error and get Winget working again.
Good to know: learn the differences between Command Prompt and PowerShell.
1. Reregister Winget
One of the biggest causes of this Winget error is a corrupt or misconfigured installation of the Windows Package Manager. If this is the case, you can easily fix it by reregistering Winget, which will reset the installation and potentially fix any problems it may have.
- Type “PowerShell” in the Search box, and click on the best match below.
- Copy and paste the following command into PowerShell, and press Enter.
Add-AppxPackage -DisableDevelopmentMode -Register "C:\Program Files\WindowsApps\Microsoft.Winget.Source_2021.718.1322.843_neutral__8wekyb3d8bbwe\AppXManifest.xml" -Verbose
2. Enable App Execution Alias for Windows Package Manager
In the command-line context, the name Winget is the app execution alias for Windows Package Manager. Basically, app execution aliases are CLI commands in their shortened or abbreviated form. If you disable this feature for the Windows Package Manager, it can cause CLIs to not recognize Winget. To enable app execution aliases for the Windows Package Manager, follow the steps below:
- Press Win + I to open the Settings app, head to “Apps -> Advanced app settings,” and click on “App execution aliases.”
- If the toggle for “Windows Package Manager Client” is “Off,” click on it to turn it on.
- Windows 10 users can find the toggle for Windows Package Manager Client by going to “Settings -> Apps -> Apps & Features,” and clicking on the “App execution aliases” link.
Tip: if you’re relatively new to PowerShell, learn these essential commands.
3. Verify You Have the Latest Version of App Installer
Winget is a part of App Installer, a preinstalled Windows package that allows users to easily install and manage programs. If App Installer glitches out, it can lead to the Winget error. To fix App Installer, update it from the Microsoft Store.
- Open Microsoft Store through Windows Search.
- Click on the search bar at the top, type “app installer,” and click on “App Installer” in the results.
- Click “Update” to begin updating App Installer.
4. Reinstall App Installer from GitHub
If updating App Installer doesn’t work, perhaps reinstalling it can help fix whatever is causing Winget to malfunction. To do that, follow the steps below:
- Go to the Windows Package Manager GitHub page.
- Scroll down to the “Assets” section, and click on the App Installer’s MSIXBundle file to download it.
- Double-click the file you just downloaded, and click on “Reinstall” in the pop-up window.
- Follow the rest of the instructions to complete reinstalling App Installer.
FYI: be sure to check out this list of Windows apps you should uninstall immediately.
5. Create a Path Environment Variable for Winget
When you run the Winget command in Command Prompt or PowerShell, Windows will search the PATH variable for the file it needs to execute it. In a nutshell, this variable maintains a list of directories that contain executables for various commands on Windows. If PATH doesn’t list the directory containing the Winget executables, you will run into the error.
To fix this, you’ll have to manually add the missing directory to the PATH variable:
- Press Win + R to bring up Windows Run, enter
systempropertiesadvancedin the text box, and click “OK.” This will launch the System Properties window.
- Select the “Advanced” tab, then click on “Environment Variables.”
- Select the “Path” variable, then click on “Edit” to open the “Edit environment variable window.”
- Copy the following file path: “%UserProfile%\AppData\Local\Microsoft\WindowsApps.”
- In the “Edit environment variable window,” click on “New.”
- Paste the file path you copied in step #4, then click “OK” to save the changes.
6. Reset Your Windows PC to Factory Defaults
If all else fails, it could mean that there’s a deeper corruption or misconfiguration with your OS at hand. If you’re at a loss on what to do, resetting Windows to factory defaults can help you start afresh with the settings and configurations that can affect Winget. But before you reset your PC, make sure you back up your important data, as you’re going to lose it in the process.
Tip: learn which option is the best when doing a Windows reset: a cloud download or local reinstall.
Get Winget Working Again on Your PC
If you prefer to install things through Windows Package Manager in Command Prompt or PowerShell, Winget is an essential utility. When the command-line tools on your PC can’t recognize it, it can dampen your Windows experience. By following the troubleshooting steps above, you can get it working again.
If you’re looking for an alternative to Winget, try using Chocolatey to install various applications on your Windows PC.
All screenshots by Chifundo Kasiya.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox