Understand Winget, Microsoft’s Windows Package Manager
This is the first article in an ongoing series I’ll be writing about winget. It provides a general overview of and introduction to this eminently useful command line utility.
Originally created for software developers, Microsoft calls winget a “Windows Package Manager for developers.” I can’t dispute this characterization, except to observe that it’s a great tool for Windows admins, too. Winget runs at the command line (and in PowerShell). It’s designed to discover, install, upgrade, remove, and configure apps (such as from Microsoft Store or similar sources) and applications (from developers through a variety of sales channels) that run in a Windows environment. Behind the scenes, developers must post package definitions for apps and applications as they change to a centralized database. This provides the reference against which winget checks local apps and applications against the most current package definition when checking for upgrades (updates), for example.
The entire winget environment is well documented and explained on the MS Learn website. Visit the February 2023 item entitled Windows Package Manager. If you end up using winget regularly – I do – you’ll want to bookmark this reference in your favorite browser.
Check Out the Other Winget Articles
Items in this series address topics such as the following:
- How to resolve multiple instances of the same app or application, some up to date and some not.
- Supplemental tools to check and manage Windows updates for which winget manifests (and packages) are unavailable.
- Troubleshooting common winget errors.
- Dealing with “pinned applications” in winget.
- Exploring the graphical WingetUI tool as a command line alternative.
- Using winget to update PowerShell; it can be tricky, especially when there is version confusion.
- Apps vs. applications in the winget context.
For later articles, see:
How Developers (Should) Use Winget
According to Microsoft, independent software vendors (ISVs) provide the inputs to winget. For them, it serves as a channel through which they can distribute software packages for their tools, apps, and applications. ISVs must include .msix, .msi, or .exe installer files in such packages. These files go to the Microsoft Package Manager Community Repository on GitHub, as part of the package manifests that ISVs submit for inclusion in the winget package environment. Microsoft adds, “Manifests are automatically validated and may also be reviewed manually.” Once validated, reviewed, and approved, those packages become available to the global community of winget users.
Note: In my March 17 blog, I described winget as subject to the “Blanche DuBois” effect based on her famous line from A Streetcar Named Desire: “I have always depended on the kindness of strangers.” In fact, Windows apps and applications won’t be accessible to or manageable through winget unless their developers provide the manifests necessary to perform installations, updates, inquiries, configurations, and removals. If you have an app or application that doesn’t (yet) work with winget, contact the developers and ask them to fix that, please – and soon, too.
Meet the Winget Commands
Here I’ll list the various commands that winget supports with a brief explanation for each one. (Find all the syntax, arguments, and examples in the previously cited Windows Package Manager reference at MS Learn.) There are many more commands than I routinely use. I mostly use upgrade, install and uninstall. I occasionally use list, show, search, and info. I have rarely used the others for non-experimental purposes (hash, export/import, settings, source, validate). Keep that in mind as you look over these items.
For convenience, I’ll list them in alphabetical order.
export: Exports a JSON formatted file containing a list of apps to a specific file (JSON schema description). Combined with the Import command, you can batch install applications on a PC. In practice, export is often used to create files to share with other developers, or to restore or repair a build environment.
features: You could call this a meta-command because it tells you what experimental features are included in your current winget version (only applies to preview versions). Features may be enabled or disabled using the Settings command (see below).
hash: Generates a SHA256 hash value for an installer; used as part of creating a manifest file for submission to the community repository on GitHub. Can also generate the same kind of hash value for MSIX files (app executables).
help: Shows help file contents for winget itself, winget commands, and winget commands with arguments. It’s a typical hierarchical help system. It can be quite useful when trying to remember arguments or syntax.
import: Imports a JSON file that lists apps to be installed. Together with Export, this command supports batch installation of a list of applications to a target PC.
info: Another meta-command, this one tells you version number, system architecture, log location, Group Policy state, and more as far as winget is concerned. Run winget –info to see how it works.
install: installs the specified app or application. Because not all install target strings are unique, winget will prompt you to refine your install target string until it’s sufficiently precise to do what you need it to do.
list: Shows a list of all applications discovered on your PC, including apps from winget as well as those from other means of installation (manual, another package manager, etc.). This is quite a handy tool to show you what’s on your PC, even if – as is often the case – winget can’t update all such things. (Some won’t have manifests in the community repository.)
search: Searches the manifest repository to show apps and applications available. It also provides precise information on how to identify an application using its name, Id, version number, and so forth. To understand what it can do, try this command string: winget search powershell. You’ll be surprised at how much comes up in response.
settings: Winget itself works from a settings file named winget.json. (Microsoft recommends using the Visual Studio Code editor to interact with this file.) Use this command If you want to tweak how winget looks and behaves. Personally, I haven’t found a need to mess with it much. I understand that the experimental features can be quite interesting for those who like to play with their tools.
show: Provides information about specific applications, including various items from the community repository such as source and metadata (version, publisher, URL, Author, Moniker, Description, and more). Run winget show Microsoft.PowerShell to see what details are displayed.
source: Lets you manage the source files for Windows Package Manager (add, remove, update, reset and more). Can be helpful when source files start throwing errors, as they sometimes do.
uninstall: Uninstalls specified applications from the target PC. This can be helpful when install methods change for apps or applications – as they sometimes do (or when switching from an application to an app alternative from Microsoft Store). Removing the old app or application and then installing the latest version turns out to be a surprisingly effective troubleshooting technique, when winget otherwise can’t update an app or application.
upgrade: My personal favorite, this command upgrades specified applications. Because the command supports strong general syntax, there’s an easy way to update nearly every app or application that winget knows about for which a higher-numbered version is available in the community repository (more on this in the following section). Indeed, winget has become my go-to tool for app and application update management on Windows PCs. It’s neither perfect nor totally comprehensive, but it is pretty darn good at keeping most apps and applications up to date.
validate: Validate a manifest as suitable for submission to the Microsoft Community Package Manifest Repository on GitHub. This takes the form of a YAML (YAML Ain’t Markup Language) file that meets all requirements from the Winget Authoring Manifests specification. I’ve never used it because I’m not involved in Windows package development day-to-day.
Updating Apps and Applications with Winget
My primary, everyday use for winget is to check for, and apply, updates for applications on my small fleet of PCs. (Its size varies by whether my son is home from college, from 11 to 13 PCs.) By far, my favorite winget command string reads:
Winget upgrade --all –-include-unknown
This command tells winget to check its list of applications and to apply upgrades for all for which a higher-numbered version is available, including those apps or applications for which the current version number is not discernable.
On my production PC, the winget list command produces information about 215 apps and applications. (On my production Windows 10 desktop PC it takes over a minute to complete because of the number of drives it must search – 11 in all – and the large number of items it finds on that machine.) On my test PCs (all of which include fewer than 130 items), this completes in as few as 10 seconds (12th-gen i9, fast RAM and SSD).
Figure 1 shows sample output from my Lenovo Yoga 7 14ITL5 (11th-gen i5-1135G7, 16 GB RAM, 1 TB NVMe SSD) when using winget to update apps and applications. It also shows the same command run again with nothing else to update. (That’s how to check that winget is done.)
After the first winget upgrade command, it found – and updated – Software Update Monitor (SUMo), Notepad++, Zoom, and Revo Uninstaller. After the second try, it reported “No installed package found matching input criteria.” That’s a back-handed way to tell you that there’s “nothing to update here.”
Where Winget Comes From
For those running Windows 10 or Windows 11 21H2 or higher, winget should be available at the command line by default. There’s no need to install this program for most Windows users. That said, if you can’t find winget or get it working, you can try a fresh installation from the GitHub winget-installer project. It works inside PowerShell to install winget properly with all its underlying and necessary infrastructure in place. One way or the other, you should be able to use this tool to check and keep your Windows apps and applications up to date.
Unwrinkling Winget’s Wrinkles
Winget has occasional oddities and gotchas. In upcoming articles in this winget series, I’ll explore and explain interesting and sometimes vexing issues that might come up when using winget. Indeed, there’s a lot to like about winget, especially when it comes to installing and updating Windows apps and applications. I hope you’ll give it a try. If you do, my best guess is that you’ll soon find it indispensable. I know I do, as I use it nearly every day.