winget, a command line package manager, doesn't have a command line installer? ๐คฃ Now it does! ๐
- Install winget-cli straight from PowerShell
- Always gets the latest version of
winget
- Works on Windows 10, Windows 11, Server 2022
- Does not work on Server 2019
- winget (and therefore this script) requires "Windows 10 version 1809 or newer (LTSC included)"
- Script automatically determines if your OS version is compatible
- Script automatically determines which version of the prerequisites to install based on your OS version
- If prerequisites are already installed, they will be updated to the latest version
- If Windows 10 or Server 2022, script will force the use of older versions of prerequisites (newer versions are not compatible)
- If Windows 11, script will use the latest versions of prerequisites from the Microsoft Store
- Processor architecture determined for prerequisites (x86/x64 or arm/arm64)
- Windows OS version determined to confirm compatibility (Windows 10, Windows 11, Server 2022)
- If Windows 10, release ID determined to confirm compatibility (1809 or newer)
- VCLibs is installed straight from the appx package
- Primary method
- If Windows 10 or Server 2022, alternate method is forced so that older version of prerequisite is used (newer version is not compatible)
- Determines the direct download URL for the appx package
- Installs appx package using direct download URL
- Alternate method (if primary download URL fails)
- Uses version 14.00 for compatibility reasons
- Installs appx package using aka.ms URL
- Primary method
- UI.Xaml is installed
- Primary method
- If Windows 10 or Server 2022, alternate method is forced so that older version of prerequisite is used (newer version is not compatible)
- Determines the direct download URL for the appx package
- Installs appx package using direct download URL
- Alternate method (if primary download URL fails)
- Uses version 2.7.3 for compatibility reasons
- Downloads nupkg package using nuget.org URL
- Extracts appx package from nupkg package
- Installs appx package using extracted appx package
- Primary method
- winget-cli is then installed using the latest version from GitHub
- Machine & User PATH variables are adjusted to include WindowsApps folder if needed
Note: please use the latest version using Install-Script or the PS1 file from Releases, the version on GitHub itself may be under development and not work properly.
Open PowerShell as Administrator and type
Install-Script winget-install -Force
Follow the prompts to complete the installation (you can tap A
to accept all prompts or Y
to select them individually.
Note: -Force
is optional but recommended, as it will force the script to update if it is outdated.
The script is published on PowerShell Gallery under winget-install
.
If you want to trust PSGallery so you aren't prompted each time you run this command, or if you're scripting this and want to ensure the script isn't interrupted the first time it runs...
Install-PackageProvider -Name "NuGet" -Force
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted
- Download the latest winget-install.ps1 from Releases
- Run the script with
.\winget-install.ps1
In PowerShell, type
winget-install
No parameters are required to run the script, but there are some optional parameters to use if needed.
Parameter | Required | Description |
---|---|---|
-DebugMode |
No | Enables debug mode, which shows additional information for debugging. |
-DisableCleanup |
No | Disables cleanup of the script and prerequisites after installation. |
-Force |
No | Ensures installation of winget and its dependencies, even if already present. |
-CheckForUpdate |
No | Checks if there is an update available for the script. |
-Version |
No | Displays the version of the script. |
-Help |
No | Displays the full help information for the script. |
- Before releasing a new version, the script is tested on a clean install of Windows 10 22H2, Server 2022 21H2, and Windows 11 22H2.
- If you run into an issue, please ensure your system is compatible & fully updated
- Try running
winget-install
again, sometimes the script will fail due to a temporary issue with the prerequisite server URLs - Try using the
-DebugMode
and-DisableCleanup
parameters to see if it provides any additional information - Try installing winget manually to see if the issue exists with winget itself
- If the issue occurs when installing winget manually, please open an issue on the winget-cli repo (unrelated to this script)
- Check the winget-cli Troubleshooting Guide
- If the problem only occurs when using this script, please open an issue here
If you're like to help develop this project: fork the repo. ๐