Skip to main content
The pin command manages package pins. Pinning prevents packages from being upgraded beyond a specified version.

Subcommands

  • winget pin add - Add a pin to a package
  • winget pin remove - Remove a pin from a package
  • winget pin list - List all pinned packages
  • winget pin reset - Reset all pins

winget pin add

Pins a package at its current version or a specified version.

Syntax

winget pin add [<query>] [options]

Options

query
string
Package to pin
--id
string
Pin by package identifier
--name
string
Pin by package name
--moniker
string
Pin by package moniker
--tag
string
Filter by package tag
--command
string
Filter by command name
-s, --source
string
Source where package is registered
-e, --exact
flag
Use exact string matching
-v, --version
string
Pin to specific version or version range (e.g., “1.2.*”)
--blocking
flag
Create blocking pin (prevents all upgrades)
--installed
flag
Pin at currently installed version
--force
flag
Override existing pin

Examples

# Pin at installed version
winget pin add Microsoft.PowerToys

# Pin to specific version
winget pin add Microsoft.PowerToys --version 0.70.0

# Pin with version range (allow patches)
winget pin add Microsoft.PowerToys --version 0.70.*

# Create blocking pin
winget pin add Microsoft.PowerToys --blocking

# Pin currently installed version
winget pin add Microsoft.PowerToys --installed

winget pin remove

Removes a pin from a package.

Syntax

winget pin remove [<query>] [options]

Options

Same filter options as pin add: --id, --name, --moniker, --source, etc.

Examples

# Remove pin by ID
winget pin remove Microsoft.PowerToys

# Remove pin with exact match
winget pin remove --id Microsoft.PowerToys --exact

winget pin list

Lists all pinned packages.

Syntax

winget pin list [<query>] [options]

Options

Supports filter options to narrow results: --id, --name, --moniker, --source

Examples

# List all pins
winget pin list

# List pins matching query
winget pin list python

Output Format

Name                 Id                    Version    Pin Type    Source
------------------------------------------------------------------------
Microsoft PowerToys  Microsoft.PowerToys   0.70.*     Gating      winget
Python 3.11          Python.Python.3.11    3.11.4     Blocking    winget

winget pin reset

Resets (removes) all pins or pins from a specific source.

Syntax

winget pin reset [options]

Options

--force
flag
Required to confirm reset operation
--source
string
Reset only pins from specified source

Examples

# Reset all pins (shows preview)
winget pin reset

# Reset all pins (execute)
winget pin reset --force

# Reset pins from specific source
winget pin reset --force --source winget

Pin Types

Blocking Pin

Prevents all upgrades of the package. Created with --blocking flag.
winget pin add Microsoft.PowerToys --blocking

Gating Pin

Prevents upgrades beyond a specified version. Created with --version flag.
winget pin add Microsoft.PowerToys --version 0.70.0

Version Ranges

Supports wildcard patterns:
  • 0.70.* - Allow patch updates
  • 0.* - Allow minor and patch updates
  • * - Allow all updates (effectively no pin)

Bypassing Pins

Pins can be bypassed using the --force flag with upgrade commands:
winget upgrade Microsoft.PowerToys --force

Exit Codes

  • 0 - Success
  • 0x8A150001 - Package not found
  • 0x8A15002D - Pin already exists
  • 0x8A15002E - Pin not found
Pins are stored locally and apply only to the current user’s WinGet configuration.
Using winget pin reset --force removes all pins immediately without confirmation.

Build docs developers (and LLMs) love