Add, remove, and manage Windows applications from the command line using Winget, Microsoft's open source package manager. Credit: TndmAgency_Yuliia Zatula/Shutterstock 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 The 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. Type 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 Python, and 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 list prints 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: IDG The full results of winget list span many more screens, but each entry lists its name, ID (used for installation and removal), version, any available upgrade, and the installation source. Upgrades and version control winget uprade lists all the packages that have upgrades available through Winget. winget uprade <package_ID> runs the upgrade for the package in question. winget pin lets 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/import dumps 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. IDG WingetUI wraps Winget (and other available package managers) in a convenient graphical interface. Just about every command exposed in Winget’s CLI is available. 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. Related content feature 14 great preprocessors for developers who love to code Sometimes it seems like the rules of programming are designed to make coding a chore. Here are 14 ways preprocessors can help make software development fun again. By Peter Wayner Nov 18, 2024 10 mins Development Tools Software Development feature Designing the APIs that accidentally power businesses Well-designed APIs, even those often-neglected internal APIs, make developers more productive and businesses more agile. By Jean Yang Nov 18, 2024 6 mins APIs Software Development news Spin 3.0 supports polyglot development using Wasm components Fermyon’s open source framework for building server-side WebAssembly apps allows developers to compose apps from components created with different languages. By Paul Krill Nov 18, 2024 2 mins Microservices Serverless Computing Development Libraries and Frameworks news Go language evolving for future hardware, AI workloads The Go team is working to adapt Go to large multicore systems, the latest hardware instructions, and the needs of developers of large-scale AI systems. By Paul Krill Nov 15, 2024 3 mins Google Go Generative AI Programming Languages Resources Videos