Winget Not Recognized? Fix It Now
In this article
If you're trying to use Winget, the Windows Package Manager, and getting the error "winget is not recognized as an internal or external command," don't worry! It's a common issue, and usually a simple fix. The problem typically stems from Winget not being added to your system's PATH environment variable, preventing your command prompt or PowerShell from finding it. This guide will walk you through the steps to resolve this, ensuring you can manage your applications easily.
What You'll Need
- A Windows 10 or Windows 11 computer. Winget is pre-installed on most modern Windows systems, but older versions might require installation.
- Administrator privileges. Many of the steps require you to run commands or modify system settings, which necessitates administrator access.
Step-by-Step
- Verify Winget Installation: First, confirm that Winget is actually installed on your system. Open PowerShell as an administrator (right-click the Start button and select "Windows PowerShell (Admin)") and type `winget --version`. If Winget is installed, it will display its version number. If you still get the "not recognized" error, proceed to the next steps. If it *does* show the version, skip to the "Common Mistakes" section.
- Check the App Installer Installation: Winget is bundled with the App Installer. Ensure the App Installer is also installed. Open "Add or remove programs" (search for it in the Start menu). Look for "App Installer" in the list of installed apps. If it’s not there, download and install it from the Microsoft Store.
- Add Winget to the PATH Environment Variable (Manual Method): This is the most common solution.
- Press the Windows key, type "environment variables," and select "Edit the system environment variables."
- Click the "Environment Variables..." button.
- In the "System variables" section (not the "User variables" section), scroll down and find the variable named "Path." Select it and click "Edit...".
- Click "New" and add the following path:
C:\Program Files\WindowsApps. This is where Winget and the App Installer are usually located. Note: The exact location might vary depending on your Windows version and installation, but this is the most common location. - Click "OK" on all the open windows to save the changes.
- Add Winget to the PATH Environment Variable (PowerShell Method): This is an alternative method using PowerShell, which can be faster.
- Open PowerShell as an administrator.
- Type the following command and press Enter:
$env:Path += ";C:\Program Files\WindowsApps" - This adds the WindowsApps directory to your PATH variable.
- Restart Your Command Prompt or PowerShell: Crucially, changes to the PATH environment variable only take effect in *new* command prompt or PowerShell windows. Close any open command prompt or PowerShell windows and open a fresh one. Then, try running `winget --version` again.
- Restart Your Computer: In rare cases, a full system restart might be necessary for the changes to fully propagate. This is especially true if you've made changes to the PATH variable through the GUI.
Common Mistakes
- Adding to User Variables instead of System Variables: The PATH variable needs to be set at the system level to be accessible to all users and applications. Adding it to the User variables only affects your current user account.
- Incorrect Path: Double-check that the path you're adding to the PATH variable is correct. A typo will prevent Winget from being found.
- Forgetting to Restart: This is the most common oversight. Changes to the PATH variable won't be recognized until you open a new command prompt or PowerShell window.
- App Installer Not Installed: Winget relies on the App Installer; ensure it's installed and up-to-date.
Tips
- Use PowerShell for PATH Modification: The PowerShell method is generally faster and less prone to errors than the GUI method.
- Verify the Path After Adding: After adding the path, open a new command prompt and type `echo %PATH%` (or `$env:Path` in PowerShell). This will display your current PATH variable. Confirm that `C:\Program Files\WindowsApps` (or the correct location) is included in the list.
- Keep Your System Updated: Ensure your Windows operating system is up-to-date. Microsoft regularly updates Winget and the App Installer, and updates often include bug fixes and performance improvements.
Troubleshooting
If the above steps don't work, here's what to check:
- Conflicting Environment Variables: It's possible that another application or script is modifying the PATH variable and overriding Winget's location. Check your startup scripts and other environment variable settings for potential conflicts.
- Corrupted System Files: In very rare cases, corrupted system files can interfere with Winget's functionality. Run the System File Checker (SFC) tool to scan and repair corrupted system files. Open Command Prompt as an administrator and type `sfc /scannow`.
- Antivirus Interference: Some antivirus programs can interfere with Winget's installation or execution. Temporarily disable your antivirus software (at your own risk) and see if that resolves the issue. If it does, you may need to add an exception for Winget in your antivirus settings.
- Windows User Profile Corruption: In extremely rare cases, your Windows user profile might be corrupted. Creating a new user profile can sometimes resolve the issue.