3.0 KiB
3.0 KiB
Winget Quick Reference
Windows Package Manager (winget) is Microsoft's CLI tool for installing, updating, and managing software.
Search for Packages
# Search by name
winget search vscode
# Web-based search UI
# https://solrevdev.com/winget-search/
Install
# Basic install
winget install <package-name>
# Install with exact ID match (-e = --exact)
winget install -e --id Microsoft.VisualStudioCode
# Install specific version
winget install -e --id Oven-sh.Bun --version 1.1.0
# Accept all agreements automatically (useful for scripts)
winget install -e --id Oven-sh.Bun --accept-package-agreements --accept-source-agreements
Installation Scope
# Install for current user only (no admin required)
winget install -e --id Oven-sh.Bun --scope user
# Install system-wide (requires admin)
winget install -e --id Oven-sh.Bun --scope machine
Uninstall
# Basic uninstall
winget uninstall <package-name>
# Uninstall with exact ID
winget uninstall -e --id Oven-sh.Bun
# Uninstall and remove app data (if supported)
winget uninstall -e --id Oven-sh.Bun --purge
Update / Upgrade
# List packages with available updates
winget upgrade
# Update a specific package
winget upgrade -e --id Oven-sh.Bun
# Update ALL packages
winget upgrade --all
# Update all, accepting agreements (for scripts)
winget upgrade --all --accept-package-agreements --accept-source-agreements
View Package Info
# Show package details (version, publisher, license, install URL)
winget show Oven-sh.Bun
# Show all available versions
winget show Oven-sh.Bun --versions
List Installed Packages
# List all installed packages (from all sources)
winget list
# Filter by name
winget list bun
Export / Import (Lockfile-like System)
Export your installed packages to a JSON file for reproducible setups:
# Export all packages
winget export -o winget-pkgs.json
# Export with pinned versions
winget export -o winget-pkgs-lock.json --include-versions
Import on a new machine:
# Install all packages from export file
winget import -i winget-pkgs-lock.json --accept-package-agreements --accept-source-agreements
Common Flags Reference
| Flag | Long Form | Description |
|---|---|---|
-e |
--exact |
Match package ID exactly |
-h |
--silent |
Silent install (no UI) |
-i |
--interactive |
Interactive install (show installer UI) |
-o |
--output |
Output file path |
-v |
--version |
Specify version |
--scope |
user or machine |
|
--accept-package-agreements |
Auto-accept package license | |
--accept-source-agreements |
Auto-accept source agreements |
Settings
Open winget settings file:
winget settings
Example settings (JSON):
{
"installBehavior": {
"preferences": {
"scope": "user"
}
}
}