How To Use Windows Package Manager (Winget) In Windows 11

Xploit Machine

Well-known member
Joined
Nov 29, 2022
Messages
784
Reaction score
73
Windows Package Manager gives you an easier way to install and manage your apps on WIndows 11 and 10. Here's how to use it. If you're a power user or somebody who's used Linux-based operating systems at some point, you're probably familiar with the concept of a package manager. This is a tool that gives you a centralized way to install and update your apps, while also potentially being faster if you prefer to work with your keyboard. Plus, it can make it easier to restore multiple apps in one go. Microsoft gives Windows 11 (and 10) users its own official package manager, simply called Windows Package Manager, but also known as winget.

The Windows Package Manager is included in Windows 11, but you won't really see it anywhere because it's part of the App Installer package (you may see this one on the Microsoft Store). It's mostly used through Windows Terminal, so it's entirely text-based. If you're interested in using Windows Package Manager to save you some time, we're here to show you how it works.
  1. Right-click the Start menu button on the taskbar and choose Terminal.​
  2. To search for an app, type winget search <AppName>. For example, let's try to find Google Chrome by typing winget search Chrome.
    If you want to include white spaces in your query (such as Google Chrome), you need to write it as winget search 'Google Chrome'. This makes it so that the search term is everything included inside the quotation marks.
    1695142471185.png
  3. If this is your first time using the winget command, you may need to agree to the terms of service. Press Y and then Enter if prompted.​
  4. In this case, you'll see a few different results with different Chrome channels, as well as some apps with similar names. To get the right app, the safest method is to use the package ID, listed in the second column. For the stable version of Google Chrome, we'll use winget install Google.Chrome.
    1695142484575.png
    • If the program you're installing is available through the Microsoft Store (the source is indicated in the last column on the list), you'll also need to agree to the terms of service. Press Y and then Enter.​
    • You can also add the --accept-package-agreements argument to the install command to automatically accept any agreements.​
  5. The installer will download and begin installing the program. Some programs can install silently without any user interaction, but Chrome actually needs your input, so you'll need to follow the appropriate steps in the dedicated setup window. You can also disable interactive prompts by adding the --disable-interactivity argument to the command above.​
  6. Once the installer finishes, you can repeat the process for any other apps you want to install.​
This makes it pretty simple to install your favorite apps using a text-based interface, and because many of these apps have silent installers through Windows Package Manager, it can be a lot faster. And yes, as we've mentioned above, you can use this to install apps from the Microsoft Store, too. You don't have to search for each one individually and click through search results to get what you want.​
 

Xploit Machine

Well-known member
Joined
Nov 29, 2022
Messages
784
Reaction score
73

Updating your apps with Windows Package Manager

Another one of the Windows Package Manager's many capabilities is keeping your apps updated through a centralized interface. If you have one or more apps that are available on the winget repository (even if you didn't necessarily install them through there), you can easily update them all in one go using Windows Package Manager.
  1. Open Windows Terminal.​
  2. Type winget update or winget upgrade to see a list of available updates for your packages.​
1695142544836.png
  1. To update a specific package, enter winget update <ID>, replacing <ID> with the appropriate ID for the app you want to update.
  2. If you want to update them all, you can enter winget update --all. Again, you can add the --include-unknown argument as well to install the latest versions of packages with unknown versions on your PC.
  3. Your packages will be updated one by one. Again, some installers may require your intervention, but you can skip it with the --disable-interactivity argument.
That's all there is to it. You can run this again whenever you'd like to make sure your apps are up-to-date.
 

Xploit Machine

Well-known member
Joined
Nov 29, 2022
Messages
784
Reaction score
73

Uninstalling apps with Windows Package Manager

Of course, just as you can install apps with Windows Package Manager, you can remove them in much the same way.
  1. Type winget list to see all the packages installed on your computer.
  2. Find the one you want to remove and use the command winget uninstall <id>, replacing <id> with th eID of the app. For example, for Chrome, it would be: winget uninstall Google.Chrome.
  3. Follow the on-screen instructions, or use the --disable-interactivity argument to have the app silently removed.​
1695142599268.png
 

Xploit Machine

Well-known member
Joined
Nov 29, 2022
Messages
784
Reaction score
73

Exporting and importing your packages with Windows Package Manager

Potentially the biggest power tool in the Windows Package Manager toolset is the ability to export a list of all the packages installed on your PC into a file. You can then import the file when setting up a new PC, and it will install all the apps on your list in one go, so you can get up and running right away.

Exporting your package list

To export the list of packages installed on your PC, simply enter the winget export -o <output> command. Replace <output> with the path where you want the package list file to be stored. Some apps may require you to agree to source agreements. You can also use arguments like --source to filter packages only from a selected source, such as winget or msstore. The --version argument can also let you export a specific version of an app, rather than installing the latest one.

1695142631957.png

In this example, we'll export the package list to my Documents library into a file called MyApps.json (the .json extension is required). For that, the command is winget export -o C:\Users\joaoc\Documents\MyApps.json, though this will vary for your username and where you want to export to.

You can move this file onto a flash drive, too, or to a cloud service like OneDrive, so you can import it later on another device. It's natural to see a lot of errors here, as many apps are preinstalled with Windows or may not come from the Windows Package Manager. Do note that this only exports a list of the packages, not the actual installers. Your new PC will need to be connected to the internet to download and install the packages when you import them.

Importing your package list

To import your list of packages, the command is winget import -i <import-file>, where you'll replace <import-file> with the path to the file you want to import from. You can also add the --accept-package-agreements argument to accept all the agreements for sources that require it.

In our example, we'll use the same file above, but we have it stored in the Downloads folder on our new PC. The command becomes winget import -i C:\Users\joaoc\Downlaods\MyApps.json --accept-package-agreements. Again, that's just our example, but it will vary depending on where the file is located.

1695142652672.png

Windows Package Manager will try to install all the apps in the package list one by one. Some packages may already be installed, simply because some of these are packages that come with Windows 11. For new apps and updates, you may need to interact with each installer, or you can use the --disable-interactivity argument to skip all interactivity for every installer when importing.

This should give you a basic understanding of how to use Windows Package Manager. You can go a bit deeper by adding custom sources for apps, such as app repositories within your company, and you can also validate manifest files for apps, but the core functionality listed above is what most people will need, and it's already very useful.

Source XDA Developers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top