Why Windows Package Management Matters
Just like apt on Linux or brew on macOS, you can install, update, and remove software with a single command on Windows. winget is Microsoft’s official package manager, and Chocolatey is a community-based package manager. Both tools automate repetitive manual installations and let you manage development environments as code.
This article compares winget and Chocolatey, covering installation, package management, and automation script creation.
Winget Basics
winget comes pre-installed on Windows 10 (1809 and later) and Windows 11. It is updated through “App Installer” in the Microsoft Store.
# Check winget version
winget --version
# Sample output: v1.9.25180
# Search for packages
winget search "visual studio code"
# Sample output:
# Name ID Version
# Visual Studio Code Microsoft.VisualStudioCode 1.96.0
# Visual Studio Code Insiders Microsoft.VisualStudioCode.Insiders 1.97.0
# Install a package
winget install Microsoft.VisualStudioCode
# Silent install (no interactive UI)
winget install Microsoft.VisualStudioCode --silent
# View package info
winget show Microsoft.VisualStudioCode
# Output: name, version, publisher, homepage, license, etc.
Winget Package Management
Updating and removing installed packages is straightforward.
# List installed packages
winget list
# Output: list of all software installed on the system
# Check for available updates
winget upgrade
# Sample output:
# Name ID Current Available
# Git Git.Git 2.43.0 2.44.0
# Node.js OpenJS.NodeJS.LTS 20.11.0 22.12.0
# Update a specific package
winget upgrade Git.Git
# Update all packages
winget upgrade --all
# Remove a package
winget uninstall Microsoft.VisualStudioCode
Environment Automation with Winget
Using winget export and winget import, you can export the list of installed packages to a file and restore them identically on another PC.
# Export installed package list
winget export -o D:\backup\packages.json
# Package IDs and versions saved as JSON
# Bulk install on another PC
winget import -i D:\backup\packages.json --accept-package-agreements
# Write a custom bulk install script
$packages = @(
"Microsoft.VisualStudioCode",
"Git.Git",
"OpenJS.NodeJS.LTS",
"Python.Python.3.12",
"Docker.DockerDesktop",
"JetBrains.IntelliJIDEA.Community",
"Mozilla.Firefox",
"Notepad++.Notepad++"
)
foreach ($pkg in $packages) {
Write-Host "Installing: $pkg" -ForegroundColor Cyan
winget install $pkg --silent --accept-package-agreements
}
Write-Host "All packages installed!" -ForegroundColor Green
Chocolatey Installation and Basics
Chocolatey is a NuGet-based Windows package manager with over 9,000 packages registered in its community repository.
# Install Chocolatey (run in admin PowerShell)
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Verify installation
choco --version
# Sample output: 2.4.1
# Search for packages
choco search nodejs
# Sample output:
# nodejs 22.12.0 [Approved]
# nodejs-lts 22.12.0 [Approved]
# nvm 1.1.12 [Approved]
# Install a package
choco install nodejs-lts -y
# -y flag: auto-approve all confirmation prompts
Chocolatey Package Management
# List installed packages
choco list
# Sample output:
# chocolatey 2.4.1
# git 2.44.0
# nodejs-lts 22.12.0
# 3 packages installed.
# Update a package
choco upgrade nodejs-lts -y
# Update all packages
choco upgrade all -y
# Remove a package
choco uninstall nodejs-lts -y
# View package info
choco info nodejs-lts
# Output: package description, version, download count, dependencies, etc.
Environment Automation with Chocolatey
Chocolatey supports bulk installation via packages.config XML files.
<!-- packages.config -->
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="git" version="2.44.0" />
<package id="nodejs-lts" />
<package id="python312" />
<package id="vscode" />
<package id="docker-desktop" />
<package id="postman" />
<package id="7zip" />
<package id="googlechrome" />
</packages>
<!-- Run: choco install packages.config -y -->
# Bulk install from packages.config
choco install packages.config -y
# Export installed packages to config
choco export packages.config
Winget vs Chocolatey Comparison
| Category | Winget | Chocolatey |
|---|---|---|
| Developer | Microsoft (official) | Chocolatey Software (community) |
| Package count | ~4,000+ | ~9,000+ |
| Installation needed | Included with Windows | Separate installation required |
| Admin privileges | Mostly not required | Mostly required |
| Export/import | JSON (export/import) | XML (packages.config) |
| GUI | None (CLI only) | Chocolatey GUI (separate install) |
| Auto-update | winget upgrade --all | choco upgrade all -y |
| Enterprise | Free | Free + paid (Business) |
Using Both Tools Together
winget and Chocolatey can be used side by side without conflicts. A common approach is to use winget for packages available there, and Chocolatey for the rest.
# Dev environment auto-setup script (setup-dev.ps1)
Write-Host "=== Installing winget packages ===" -ForegroundColor Cyan
$wingetPkgs = @(
"Microsoft.VisualStudioCode",
"Git.Git",
"Docker.DockerDesktop"
)
foreach ($pkg in $wingetPkgs) {
winget install $pkg --silent --accept-package-agreements
}
Write-Host "=== Installing Chocolatey packages ===" -ForegroundColor Cyan
$chocoPkgs = @(
"nvm", # Not available in winget
"make", # GNU Make
"jq" # JSON processing tool
)
foreach ($pkg in $chocoPkgs) {
choco install $pkg -y
}
Write-Host "Dev environment setup complete!" -ForegroundColor Green
Practical Tips
- Prefer winget: As the official Microsoft tool, use winget for packages available there
- Chocolatey as supplement: Use Chocolatey for CLI tools not in winget (make, jq, wget, etc.)
- Version control your scripts: Managing install scripts with Git lets you reproduce identical environments across multiple PCs
- Regular updates: Periodically run
winget upgrade --allandchoco upgrade all -yto apply security patches - Scoop: A third alternative exists — Scoop installs to the user directory without admin privileges, making it suitable for personal dev environments