The Winget Repair Tool is a targeted PowerShell script designed to fix common issues with the Windows Package Manager (winget). If you are encountering errors like "winget is not recognized" or profile loading errors related to winget.exe, this script performs a clean re-installation of the App Installer package to resolve them.
Built by: Zachary Whiteman & Google Gemini Ai.
This script is a repair utility for the Windows Package Manager.
To run this script, you will need:
- Windows Operating System.
- PowerShell 5.1 or newer.
- Administrator Privileges: The script requires administrator access to uninstall and reinstall AppX packages for all users.
- Internet Connection: Required to download the latest installer from the official GitHub repository.
- Download: Download the
Winget-Repair-Tool.PS1script file. - Unblock: Right-click the file, go to Properties, and click
Unblock. - Run as Administrator: Right-click the script and select "Run with PowerShell". Ensure you run it from an elevated context.
.\Winget-Repair-Tool.PS1
The script runs automatically once launched as an administrator. It performs the following steps:
- Uninstall: It attempts to remove the existing "Microsoft.DesktopAppInstaller" package to clear out any corrupted files.
- Download: It downloads the latest stable
wingetrelease bundle (.msixbundle) directly from the official Microsoft GitHub repository. - Install: It installs the downloaded package using
Add-AppxPackage. - Path Verification: It checks your User environment variables to ensure the
Microsoft\WindowsAppsdirectory is in yourPATH. If missing, it adds it, ensuring you can runwingetfrom any command prompt.
- Clean Reinstall: Removes potentially broken installations before applying the new one.
- Official Source: Downloads directly from the official
microsoft/winget-cliGitHub releases. - Environment Fix: Automatically corrects
PATHvariable issues that preventwingetfrom being recognized. - Automated Cleanup: Deletes the temporary installer file after the operation is complete.
- Scripting Language: PowerShell
- Core Cmdlets:
Get-AppxPackage,Remove-AppxPackage,Add-AppxPackagefor managing the application. - Environment: .NET
[Environment]class for modifying user variables.
- Administrator Required: This script must be run as an administrator to manage system packages.
- System Change: It modifies the installed AppX packages and User Environment variables.
- Restart Required: After running, you typically need to close and reopen your terminal windows (PowerShell, CMD) for the
PATHchanges to take effect.
Distributed under the MIT License. See LICENSE.txt for more information.
Zach Whiteman - elitesoftwarecolimited@gmail.com
HuggingFace - https://huggingface.co/EliteSoftware
HuggingFace (Personal) - https://huggingface.co/TheShadyRainbow
LinkTree - https://linktr.ee/zachrainbow