In the Linux world, package managers catalog and install the software available in a given Linux distribution. Until recently, Microsoft Windows software management wasn’t that centralized. There was a system for adding or removing components for Windows itself, but not for third-party apps. And while we do have the Microsoft Store as an app-management solution, it’s a proprietary system that’s aimed mainly at consumers, not developers or admins.
Winget is a Microsoft-authored and -managed open source system for cataloging and managing software installations in Windows. It’s meant to provide the closest thing we have to an official package management system for Windows that’s not also a proprietary solution (like the Microsoft Store), focused on one aspect of the Microsoft ecosystem (like NuGet, which is chiefly for .NET components), or a third-party offering (like Chocolatey or Scoop).
Getting started with Winget
If you’re using Windows 11, Winget should be available by default, so you won’t need to install anything. For earlier versions of Windows, you can use the App Installer app from the Microsoft Store to install Winget.
Once the installer finishes, you should be able to type
winget at a command prompt to run it.
How Winget works
winget command lets you connect to, by default, a Microsoft-curated repository of software installers. You can search the repository, download installers for the applications you want, set them up, keep track of what’s installed, and remove applications.
winget itself doesn’t actually install anything. It obtains the application installers and runs them, along with any options you want to provide manually. To that end, you don’t need to run
winget itself from an elevated prompt, but the system may prompt you for permissions when
winget launches a given application installer.
winget can also work with multiple sources for software installations. The default is Microsoft’s Winget repository, but you can add other repositories that follow a certain format, or track what’s already been installed locally, as well.
Basic Winget commands
The first thing you’re likely to do with
winget is search for things to install.
winget search <search_term> and
winget will look through the currently configured repositories for whatever matches your search term. For instance,
winget search Python will search for anything matching the keyword
winget search "SQL Server" looks for anything matching the term
SQL Server. (Note that any search term with spaces needs to be set off in quotes.)
Search results list the name of a package, its unique identifier in its repository, optionally a version number, how the match was found (e.g., in the name or the description), and what repository it was found in. The
ID column, the unique identifier, lists the name to use when you want to actually install something.
In a search for
Python, for instance, one of the matches may be
Python 3.11, with the ID
Python.Python.3.11. If you want to install that package, you’d use
winget install Python.Python.3.11. This would download that package and automatically start the installation process for it.
The same goes for removing a package. You would use
winget uninstall <id> (e.g.,
winget uninstall Python.Python.3.11), to start the uninstaller for that package.
Common Winget usage
Once you start using
winget more often, some other commands will become useful.
Listing and getting package details
winget listprints out all the currently installed packages—names, IDs, versions, etc. Note that this by default goes to the console, so you may want to redirect it to a file to read conveniently.
winget show <package_ID>prints out details about a given package, as identified by its ID.
Here’s the output from a
winget list command:
Upgrades and version control
winget upradelists all the packages that have upgrades available through Winget.
winget uprade <package_ID>runs the upgrade for the package in question.
winget pinlets you “pin” a given package to its current version so that it isn’t upgraded. This way, you can ensure a given package remains at a stable version, or within a given range of versions.
Saving and loading package manifests
winget export/importdumps out or reads in the contents of the current package listing to or from a JSON format file. If you have a slew of packages you want to install reproducibly on multiple machines, this lets you generate a manifest for automating the setup process.
Adding packages to Winget’s repository
If you’ve written software that you want to distribute through Winget, Microsoft lets you do this for free, and with tooling you probably already use. You’ll need to create a package manifest file for your project, written in YAML format, and you’ll need to submit it to the Windows Package Manager repository as a GitHub pull request. But apart from the work involved on your part, there is no cost to you for adding or keeping a project in Winget’s repos.
Third-party Winget apps
If you are not fond of using the
winget command-line interface, third-party utilities wrap
winget in more convenient interfaces. One such program is WingetUI, which wraps not only
winget but numerous other package management tools for Windows.
Most everything possible with the
winget CLI can also be done through WingetUI’s interface. And you can always drop back to using
winget at the command line if needed.
Copyright © 2023 IDG Communications, Inc.