The winget command line tool enables users to discover, install, upgrade, remove and configure applications on Windows 10 and Windows 11 computers. This tool is the client interface to the Windows Package Manager service.
The winget command line tool is only supported on Windows 10 1709 (build 16299) or later at this time. The winget tool will not be available until you have logged into Windows as a user for the first time, triggering Microsoft Store to register Windows Package Manager as part of an asynchronous process. If you have recently logged in as a user for the first time and find that winget is not yet available, you can open PowerShell and enter the following command to request this winget registration: Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.
winget install
Download the latest winget preview version. Read the Release notes for winget preview to learn about any new features. Installing this package will give you the preview version of the WinGet client, but it will not enable automatic updates of new preview versions from the Microsoft Store.
Windows Sandbox provides a lightweight desktop environment to safely run applications in isolation. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the host machine. Windows Sandbox does not include winget, nor the Microsoft Store app, so you will need to download the latest winget package from the winget releases page on GitHub.
When running winget without administrator privileges, some applications may require elevation to install. When the installer runs, Windows will prompt you to elevate. If you choose not to elevate, the application will fail to install.
When running winget in an Administrator Command Prompt, you will not see elevation prompts if the application requires it. Always use caution when running your command prompt as an administrator, and only install applications you trust.
After you have confirmed that the tool you want is available, you can install the tool by typing winget install . The winget tool will launch the installer and install the application on your PC.
In addition to install and search, winget provides a number of other commands that enable you to show details on applications, change sources, and validate packages. To get a complete list of commands, type: winget --help.
When scripted, winget will launch the applications in the specified order. When an installer returns success or failure, winget will launch the next installer. If an installer launches another process, it is possible that it will return to winget prematurely. This will cause winget to install the next installer before the previous installer has completed.
You can configure the winget command line experience by modifying the settings.json file. For more information, see -settings. Note that the settings are still in an experimental state and not yet finalized for the preview version of the tool.
The install command requires that you specify the exact string to install. If there is any ambiguity, you will be prompted to further filter the install command to an exact application.
If the query provided to winget does not result in a single application, then winget will display the results of the search. This will provide you with the additional data necessary to refine the search for a correct install.
The manifest option enables you to install an application by passing in a YAML file directly to the client. If the manifest is a multi-file manifest, the directory containing the files must be used. The manifest option has the following usage.
Installing packages from local manifest files may have risks. As an extra measure of precaution this feature needs to be enabled by an administrator. To enable this feature run winget settings --enable LocalManifestFiles. To disable this feature run winget settings --disable LocalManifestFiles.
Some applications when installed will require the user to agree to the license or other agreements before installing. When this occurs, the Windows Package Manager will prompt the user to agree to the agreements. If the user does not agree, the application will not install.
I'm trying to write a PowerShell script to setup windows dev machines. I want to use winget but I don't see any easy way just to install winget using the commandline. You have to either use the windows store or download the msxibundle from github.
After having downloaded your msixbundle into .\MicrosoftDesktopAppInstaller_8wekyb3d8bbwe.msixbundle, you can install it using Windows PowerShell (not PowerShell Core), there's a command to help: Add-AppXPackage:
It's a per user appxpackage. This worked for me from -us/windows/package-manager/winget/#install-winget. You have to pipe 'y' to it the first time to accept the eula (or there's an --accept-source-agreements parameter). Winget seems pretty dopey. The powershell module is only for powershell 7.
winget is an open-source Windows package manager designed by Microsoft for Windows 10 and Windows 11. The client installs and manages applications using a CLI, similar to the apt package manager in Linux.
Note: The winget client requires Windows 10 1809 (build 17763) or newer. Windows Server 2019 isn't supported because the Microsoft Store and other dependencies are not available for Windows Server.
If you are already running Windows 10 1809 or newer, the client may already be available on your system. Check if winget is available by invoking the winget command in the Command Prompt or PowerShell:
The first time you use winget, a prompt appears asking if you agree to Microsoft's transaction terms. This is because the Microsoft Store repository requires your geographic region to function correctly.
For [package_name], specify the exact application ID. In the following example, we instruct winget to install Notepad++, and winget prompts for the app ID since Notepad++ is available in two repositories.
Use the reset --force subcommand to reset winget back to its original configuration, removing all third-party repositories and setting the sources to the default ones.
This tutorial showed how to install and use the winget package manager on Windows. Use winget to automate package management, installation, and configuration, while keeping your apps up to date and system secure.
I have verified that the currently installed Zotero version is 6.0.13. Since I have had prior installations of Zotero with and without winget, I think, these entries might reflect those installations. So, I wanted to uninstall / remove these without removing version 6.0.13, currently installed at C:\Program Files (x86)\Zotero.
Regarding Zotero itself, I couldn't find a package with ID Zotero.Zotero, but did find DigitalScholar.Zotero. That shows that the default installer's used, so the default path would be the same as the app's (from hunting around their docs this seems to be C:\Program Files (x86)\Zotero, though I've not seen anything explicit).
Note: It's possible that your additional version of Zotero.Zotero doesn't exist on disk; but only exists in WinGet's database (e.g. if it were installed then the path deleted without WinGet being aware). See "Failed Attempt to Hunt Out Metadata" for info on how to query that database).
I wondered if you could find the path under which WinGet stores the metadata of packages installed... I couldn't - but notes below in case this helps others hunt deeper (my conclusion is that WinGet doesn't remember where it installs things, only that it has installed them / what version it installed; everything else is left to the default installer).
You can get the path for its settings file by running winget settings then looking at the path of the settings.json file that this opens. For me this was: C:\Users\myUsername\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
By poking around in that directory I found a SQLLite DB: C:\Users\myUsername\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db.
Disclaimer: At time of writing, Windows Package Manager and the winget tool are in public preview and may be substantially modified before they are generally available. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Once installed you can run commands for search, show, install and more. I tested a few installations interactively but once I got the hang of it I scripted out a list of commonly used tools and applications that I use on almost all of my machines. Below is my script that you are free to copy and adapt as you see fit. I have chosen PowerShell to run the script but that is not a requirement.
Do read the note (link) in documentation about scripting winget. If an installer launches a new process that can lead to starting the next installation before the previous completes. This may result in unexpected issues or failed installations.
I found winget to be very helpful in re-installing a dozen or more applications on my refreshed laptop. The next time you need to install (or re-install) an application I would encourage you to check for it with the Windows Packager Manager and winget tool. Happy installing!
In my last article about Windows Package Manager, I said that with winget I was missing "being able to specify some parameters for a package installation (like the workload and components to install for Visual Studio 2019)". Well, that was before I went through a few GitHub issues of the winget-cli repository that mentioned the override option.
35fe9a5643