# winget — The Windows Package Manager

> Practical guide to winget — Microsoft's official package manager for Windows 10/11: search, install, and update apps and reproduce setups with export/import.

Source: https://www.jpkc.com/db/en/cheatsheets/package-managers/winget/

<!-- PROSE:intro -->
winget is Microsoft's official package manager for Windows 10 and 11 – it lets you search, install, update, and remove applications straight from the command line, without clicking through setup wizards. Packages come from the public winget repository (a large community source) and the Microsoft Store, so a single command gets you thousands of common programs. The standout feature is the pair `winget export` and `winget import`: capture your software setup as a JSON file and reproduce it on a new or freshly imaged machine. This guide walks you through the commands you reach for daily – from searching to silent installs to pinning individual packages to a specific version.
<!-- PROSE:intro:end -->

## Search & Info

`winget search <query>` — Search for packages by name or keyword.

```bash
winget search firefox
```

`winget search --id <id>` — Search by exact package identifier.

```bash
winget search --id Mozilla.Firefox
```

`winget show <package>` — Show detailed info about a package.

```bash
winget show Mozilla.Firefox
```

`winget show <package> --versions` — List all available versions of a package.

```bash
winget show Microsoft.VisualStudioCode --versions
```

## Install

`winget install <package>` — Install a package.

```bash
winget install Mozilla.Firefox
```

`winget install <package> --version <ver>` — Install a specific version.

```bash
winget install Python.Python.3.12 --version 3.12.2
```

`winget install <package> --silent` — Install silently (no installer UI).

```bash
winget install Microsoft.VisualStudioCode --silent
```

`winget install <package> --location <path>` — Install to a custom location.

```bash
winget install Git.Git --location D:\Tools\Git
```

`winget install <package> --accept-source-agreements --accept-package-agreements` — Install accepting all agreements (non-interactive).

```bash
winget install Docker.DockerDesktop --accept-source-agreements --accept-package-agreements
```

`winget install <package> --scope machine` — Install for all users (system-wide).

```bash
winget install Notepad++.Notepad++ --scope machine
```

## Update & Upgrade

`winget upgrade` — List all packages with available updates.

```bash
winget upgrade
```

`winget upgrade <package>` — Update a specific package.

```bash
winget upgrade Mozilla.Firefox
```

`winget upgrade --all` — Update all packages with available updates.

```bash
winget upgrade --all
```

`winget upgrade --all --silent` — Update all packages silently.

```bash
winget upgrade --all --silent
```

`winget upgrade --include-unknown` — Include packages with unknown versions in upgrade.

```bash
winget upgrade --all --include-unknown
```

## Uninstall & List

`winget uninstall <package>` — Uninstall a package.

```bash
winget uninstall Mozilla.Firefox
```

`winget uninstall <package> --purge` — Uninstall and remove all data/settings.

```bash
winget uninstall Microsoft.Teams --purge
```

`winget list` — List all installed packages.

```bash
winget list
```

`winget list <query>` — Search installed packages.

```bash
winget list python
```

`winget list --source winget` — List only packages from the winget source.

```bash
winget list --source winget
```

## Export & Import

`winget export -o <file>` — Export installed packages to a JSON file.

```bash
winget export -o packages.json
```

`winget import -i <file>` — Install packages from an exported JSON file.

```bash
winget import -i packages.json
```

`winget import -i <file> --accept-source-agreements --accept-package-agreements` — Import packages non-interactively.

```bash
winget import -i packages.json --accept-source-agreements --accept-package-agreements
```

## Sources & Settings

`winget source list` — List configured package sources.

```bash
winget source list
```

`winget source update` — Update all package source indexes.

```bash
winget source update
```

`winget source add --name <name> <url>` — Add a custom package source.

```bash
winget source add --name myrepo https://repo.example.com
```

`winget source remove --name <name>` — Remove a package source.

```bash
winget source remove --name myrepo
```

`winget settings` — Open the winget settings file in the default editor.

```bash
winget settings
```

`winget --info` — Show winget version, logs path, and links.

```bash
winget --info
```

## Pin (Version Lock)

`winget pin add <package>` — Pin a package to prevent automatic updates.

```bash
winget pin add Python.Python.3.12
```

`winget pin add <package> --version <ver>` — Pin a package to a specific version.

```bash
winget pin add Node.js --version 20.11.0
```

`winget pin list` — List all pinned packages.

```bash
winget pin list
```

`winget pin remove <package>` — Remove a pin from a package.

```bash
winget pin remove Python.Python.3.12
```

<!-- PROSE:outro -->
## Conclusion

winget finally makes Windows a system you can manage like a modern developer setup: one command instead of download, double-click, and "Next, Next, Finish". Its biggest payoff comes from pairing `winget export` with `winget import` – document your entire software state and restore it reproducibly on a new machine. On the first run, watch the license and source agreements: `--accept-source-agreements` and `--accept-package-agreements` make installs scriptable, but they also accept the license terms of every package, so use them deliberately. Prefer installing from the trusted default sources `winget` (community repository) and `msstore` (Microsoft Store), and be cautious with sources you add yourself. With `winget upgrade --all` you keep your whole system current in one pass, while pinned packages stay locked to their chosen version.

## Further Reading

- [Windows Package Manager – Microsoft Learn](https://learn.microsoft.com/windows/package-manager/) – official winget documentation
- [winget command reference – Microsoft Learn](https://learn.microsoft.com/windows/package-manager/winget/) – every subcommand and option in detail
- [winget-cli on GitHub](https://github.com/microsoft/winget-cli) – source code, releases and issue tracker
<!-- PROSE:outro:end -->

## Related Commands

- [apk](https://www.jpkc.com/db/en/cheatsheets/package-managers/apk/) – Alpine Linux package manager
- [apt](https://www.jpkc.com/db/en/cheatsheets/package-managers/apt/) – friendly package front-end for Debian/Ubuntu
- [apt-get](https://www.jpkc.com/db/en/cheatsheets/package-managers/apt-get/) – the classic, script-stable APT tool

