How to Use the winget Command in Windows 11 to Batch Install, Update, and Export Software Packages

Setting up a newly imaged Windows 11 PC historically involved hours of repetitive, manual tasks: launching a web browser, navigating to dozens of vendor websites, downloading disparate .exe and .msi installers, clicking through multi-step wizard prompts, and unchecking unwanted bundled adware. Furthermore, keeping third-party software updated across enterprise fleets frequently required dedicated patch management agents or individual in-app updater prompts.

To modernize software distribution, Microsoft developed the Windows Package Manager: winget. Built directly into Windows 11 via the App Installer framework, winget provides a native command-line interface modeled after modern Linux package management suites (such as apt and dnf). With winget, administrators and developers can search public software repositories, execute unattended silent installations, update all installed software with a single command, and export complete application environments to JSON files for rapid workstation bootstrapping. This technical guide explores syntax patterns, search queries, multi-package scripting, and JSON export/import workflows.

Essential winget Commands Reference

Open Command Prompt or PowerShell (elevated as Administrator for system-wide installers) to run these primary operations:

Command Syntax Primary Function Example Use Case
winget search <query> Searches the Microsoft Community Repository and Microsoft Store for matching packages. winget search "Visual Studio Code"
winget install <id> Downloads and installs a designated package using its exact unique identifier. winget install Microsoft.VisualStudioCode
winget upgrade Lists all installed software on the machine with available newer versions. Auditing outdated applications and runtime libraries.
winget upgrade --all Downloads and applies updates to every upgradeable application in a single pass. Automating weekly system maintenance and security patching.
winget uninstall <id> Executes unattended uninstallation of specified software. winget uninstall Zoom.Zoom
winget export / import Dumps or ingests JSON manifests containing all installed packages. Replicating identical software setups across team workstations.

Step 1: Searching and Installing Software Packages

Always search for software using winget search to verify the exact Package ID before installing, preventing ambiguous name collisions:

winget search git

The console prints matching results with their Name, Id, and Version. Install the official package using its exact ID:

winget install --id Git.Git -e --silent --accept-package-agreements --accept-source-agreements

Command parameters explained:

  • --id Git.Git -e — Specifies the exact (-e) unique package ID rather than a fuzzy name match.
  • --silent — Suppresses graphical installation windows and installer prompts, executing completely unattended.
  • --accept-package-agreements — Automatically accepts third-party software end-user licensing agreements (EULA).
  • --accept-source-agreements — Authorizes source catalog terms.

Step 2: Performing System-Wide Software Upgrades (winget upgrade)

To inspect and update all third-party software installed on your Windows 11 machine:

1. Listing Outdated Applications

winget upgrade

The output table displays the application name, current installed version, and the latest available version in the repository.

2. Upgrading All Outdated Applications Simultaneously

winget upgrade --all --silent --accept-package-agreements --accept-source-agreements

Winget loops through each outdated application in sequence, downloading official installers and upgrading them quietly in the background without user intervention.

Step 3: Creating an Automated Multi-Package Setup Script

For IT onboarding, create a PowerShell script (install_developer_stack.ps1) to provision a complete developer or workstation stack in minutes:

$Packages = @(
    "Microsoft.VisualStudioCode",
    "Git.Git",
    "Google.Chrome",
    "7zip.7zip",
    "Notepad++.Notepad++",
    "Docker.DockerDesktop",
    "Python.Python.3.12"
)

foreach ($Package in $Packages) {
    Write-Host "Installing: $Package..." -ForegroundColor Cyan
    winget install --id $Package -e --silent --accept-package-agreements --accept-source-agreements
}
Write-Host "All software packages installed successfully!" -ForegroundColor Green

Step 4: Exporting and Importing Machine Configurations (JSON Manifests)

When migrating to a new laptop or deploying standard desktop environments across corporate departments, export your current software roster to a portable JSON file:

Exporting Installed Software

winget export -o "C:\Configurations\MyWorkstationSetup.json" --include-versions

Winget inspects all installed programs and writes a structured JSON document cataloging their package IDs and repositories.

Importing on a Fresh Windows 11 PC

Transfer the JSON file to your new computer and execute:

winget import -i "C:\Configurations\MyWorkstationSetup.json" --accept-package-agreements --accept-source-agreements

Winget automatically parses the file and downloads, verifies, and installs every listed application unattended.

Operational Best Practices and Pinning Rules

  • Pinning Versions to Prevent Unwanted Updates: If you must maintain a specific legacy version of a software tool (e.g., Python 3.10 or a specific Node build), pin the version to exclude it from winget upgrade --all:
    winget pin add --id Python.Python.3.10 --blocking
  • Managing Sources: Winget pulls from two primary sources: the community winget repo and the msstore (Microsoft Store). Inspect active sources with winget source list.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.