WINGET - Package Manager
Installing an app usually means finding the official site, downloading an installer, and clicking “Next” through a wizard. Doing that for every app takes time.
With winget (Windows Package Manager), you can search for, install, update, and remove apps from Command Prompt.
What is winget?
winget is a command-line package manager for Windows. On Windows 11 and recent versions of Windows 10, it is included as part of the “App Installer” package.
First, check that it works in Command Prompt.
winget --version
If a version number appears, you are ready to go (the number varies by environment). If you see a message saying that ‘winget’ is not recognized as an internal or external command, update “App Installer” from the Microsoft Store.
winget itself runs in a normal Command Prompt. However, some apps show an administrator prompt (UAC) during installation. To handle system-wide installs without interruption, start Command Prompt as administrator by following
.Main commands
| Command | Description |
|---|---|
winget search name | Search for an app |
winget show ID | Show detailed information about an app |
winget install ID | Install an app |
winget list | List installed apps |
winget upgrade | List apps that have updates available |
winget upgrade ID | Update a specific app |
winget uninstall ID | Uninstall an app |
winget export / import | Save the app list, and restore from it |
Searching for an app
winget search vscode

中小企業経営者のためのRPA入門 RPA導入を成功させる方法

60分でわかる! AIエージェント 超入門

コマンドラインの黒い画面が怖いんです。

知識・才能ゼロでもらく~に月10万円稼ぐ! よくわかるAI副業超入門
The output shows the name, ID, version, and more. In later commands it is safest to use the ID, which usually follows the format Publisher.AppName.
The columns and versions in search results vary by winget version and over time. The output above is only an example.
Installing an app
winget install --id Microsoft.VisualStudioCode -e
--id specifies the ID, and -e (--exact) limits matches to the exact ID or name. Without it, partial matches can produce several candidates and cause an error.
On the first install, you may be asked to agree to the terms of the source (where packages are distributed from). Type Y to continue.
Common options
| Option | Description |
|---|---|
-e, --exact | Match the name or ID exactly |
--id ID | Specify the ID |
-s, --source name | Specify the source to search (for example winget) |
--version version | Install a specific version |
-h, --silent | Install without showing the installer UI |
--accept-package-agreements | Automatically accept the package license |
--accept-source-agreements | Automatically accept the source terms |
To run without prompts, combine them like this:
winget install --id Git.Git -e --silent --accept-package-agreements --accept-source-agreements
--accept-package-agreements automates agreeing to a license. Do not use it for apps whose terms you have not read.
Checking installed apps
winget list
Apps installed by other methods also appear in the list. You can filter by name.
winget list git
Updating apps
Show the apps that have updates available:
winget upgrade
To update only one app, specify its ID.
winget upgrade --id Git.Git -e
To update everything that has an update, use --all.
winget upgrade --all
winget upgrade shows the number of available updates at the end. Review the list first, then run --all for peace of mind.
Apps whose version cannot be determined may be skipped by a normal winget upgrade --all. You can add --include-unknown if you need them, but unintended apps may be updated, so review the list first.
Uninstalling an app
winget uninstall --id Git.Git -e
Saving the app list and restoring it on another PC
export and import are useful when you replace a PC or set one up again.
winget export -o apps.json
winget import -i apps.json
apps.json is a JSON file that records the IDs of apps available from a source. Apps that are not registered in a source cannot be restored.
If you import a JSON file from someone else as is, every app listed in it is installed. Always check the contents first.
Automating with a batch file
Here is an example batch file for setting up a new PC.
@echo off
for %%I in (Git.Git Microsoft.VisualStudioCode 7zip.7zip) do (
echo Installing %%I ...
winget install --id %%I -e --silent --accept-package-agreements --accept-source-agreements
if errorlevel 1 echo [Warning] winget returned an error for %%I.
)
echo Done.
pause
winget returns 0 on success. However, it may also end with a non-zero exit code when, for example, the app is already installed or no update is available. Treat the warning in the example above as a rough guide: it may also appear for apps that are already installed. For exit codes in general, see
Troubleshooting
- An error appears when searching a source (such as msstore): Run
winget source updateand try again. - It says multiple apps were found: Add
-eand specify the ID, or check the ID withwinget search. - You do not know the ID: Look it up with
winget search app-name.
Summary
| Goal | Command |
|---|---|
| Find an app | winget search name |
| Install | winget install --id ID -e |
| See available updates | winget upgrade |
| Update everything | winget upgrade --all |
| Uninstall | winget uninstall --id ID -e |
| Save and restore the list | winget export -o file / winget import -i file |