WinGet - the Windows Package Manager
What is a package manager and why is it so useful?
A package manager is a collection of software tools for automating the installation, upgrade, configuration, and removal of computer programs on a computer in a unified way.
Basically, a package manager makes it easier to manage all the software on a computer. Software is installed from a central location and can then be updated. This eliminates the need to update each application at startup or even manually download new versions from the manufacturer's website.
The Package Manager requires the appropriate software packages. These in turn contain installation media and other metadata for deployment, as well as any dependencies on other components. Software packages are either provided directly by software vendors or maintained by communities.
What has long been standard on Linux-based operating systems was, for a long time, only available on Windows through third-party software such as Chocolatey or Scoop, until Microsoft announced its own package manager in May 2020 - WinGet.
WinGet - the Windows Package Manager ๐ฆโ
The Windows Package Manager (WinGet) is designed by Microsoft as a free and open-source package manager for Windows 10 (Windows 10 1709 (build 16299) or later) and Windows 11. Therefore, WinGet can theoretically be built by yourself. However, the tool is also distributed as part of the App Installer via the Microsoft Store.
The App Installer is already supplied in current versions of Windows 11 and may only need to be updated via the Microsoft Store. Of course, you can also install the latest version of GitHub. (See Install WinGet)
WinGet uses two different package sources by default:
- Microsoft Store
msstore
, to install Store Apps winget
, the community-driven repository for Windows Package Manager manifests
WinGet will be available only as a CLI (command-line interface) tool. However, you could also use a tool like WingetUI.
Install WinGetโ
To install the latest version, use Powershell to run the following code
Add-AppxPackage -Path "https://github.com/microsoft/winget-cli/releases/latest/download/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle" -ForceApplicationShutdown
You can also update or install WinGet using the App Installer from the Microsoft Store. If this does not work, please check the instructions provided by Microsoft at Install WinGet
Commands and usage of WinGet ๐โ
After installing WinGet, you can view the current version winget -v
or a more detailed overview with winget --info
.
The full list of commands can also be found in Microsoft Docs or by running winget --help
.
Most of the time you want to search for packages and install, update or uninstall them.
Search: winget search <name>
, e.g.
winget search powertoys
# this will give you an output like this:
#
# Name Id Version Match Source
# ------------------------------------------------------------------------------------------------------
# Microsoft PowerToys XP89DCGQ3K6VLD Unknown msstore
# PowerToys (Preview) Microsoft.PowerToys 0.85.0 Moniker: powertoys winget
# EverythingPowerToys lin-ycv.EverythingPowerToys 0.82.1 Tag: powertoys winget
# PowerToys-Run-Currency-Converter advaith.CurrencyConverterPowerToys 1.3.0 Tag: PowerToys winget
So you will get the name, id, version and the source of the packages found. This information can be used to install the desired package.
Install: winget install <name or id>
winget install powertoys
# output:
# Multiple packages found matching input criteria. Please refine the input.
# Name Id Source
# -----------------------------------------------
# Microsoft PowerToys XP89DCGQ3K6VLD msstore
# PowerToys (Preview) Microsoft.PowerToys winget
You will usually find more than one package for a name. It is therefore advisable to install the package directly via the Id winget install Microsoft.PowerToys
or to specify the source winget install powertoys -s winget
.
winget install Microsoft.PowerToys
# output:
# Found PowerToys (Preview) [Microsoft.PowerToys] Version 0.85.0
# This application is licensed to you by its owner.
# Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
# Downloading https://github.com/microsoft/PowerToys/releases/download/v0.85.0/PowerToysUserSetup-0.85.0-x64.exe
# Successfully verified installer hash
# Starting package install...
If you want to remove/uninstall a package again, you can do so in the same way using the "uninstall" command.
Uninstall: winget uninstall <name or id>
winget uninstall PowerToys
# output:
# Found PowerToys (Preview) x64 [Microsoft.PowerToys]
# Starting package uninstall...
# Successfully uninstalled
But the best part of all comes at the very end!
You can update all your packages installed via WinGet with a single command.
Upgrade: winget upgrade --all
This command determines all available updates for installed packages and updates them.
However, individual packages can also be updated as usual by entering the name or id winget upgrade <name or id>
Scripting / Automation โกโ
The whole thing becomes much more useful if you use these commands in scripts.
I published a small script that helps to install WinGet. It installs some packages and sets a job to automatically update the packages on system startup.
All that is needed is to set up a scheduled task which runs the appropiate command on system startup.
$trigger = New-ScheduledTaskTrigger -AtLogOn
$action = New-ScheduledTaskAction -Execute "PowerShell" -Argument "winget upgrade --all --silent --accept-package-agreements --accept-source-agreements"
Register-ScheduledTask -TaskName "WinGet Auto-updates" -TaskPath "winget-toolbox" -Action $action -Trigger $trigger | Out-Null
Write-Output "[+] Created a scheduled task to enable auto updates via winget on system start up"
Over the Christmas holidays I experimented a bit with WinGet, the Windows Terminal and Windows 11 itself. As I find it very annoying to set up a new system, I tried to create a collection of scripts that would make these tasks as easy as possible for me. The repository win11-setup is already available and a blog post is sure to follow ๐ซฃ