
Chocolatey is a command-line package manager for Windows that simplifies the process of installing, updating, and managing software. It automates what would typically require manual downloads and setups, making it especially useful for system administrators, developers, and power users.
This article explains how to install Chocolatey, manage software packages using simple commands, and streamline your Windows environment setup. Whether you're deploying tools on a personal machine or provisioning multiple systems, Chocolatey helps you save time and ensure consistency.
The Short Answer Version
For a swift overview, here are some essential Chocolatey commands:
# Check Chocolatey version
choco --version
# Search for a package
choco search <package-name>
# Install a package
choco install <package-name> -y
# Install multiple packages
choco install <package1> <package2> -y
# Upgrade a package
choco upgrade <package-name> -y
# Uninstall a package
choco uninstall <package-name> -y
# List installed packages
choco list --local-only
Installing Chocolatey
Chocolatey supports installation via either Command Prompt or PowerShell. Both methods are nearly identical in behavior, but PowerShell offers more flexibility for automation scripts. In either case, administrative privileges are required. Once installed, you can immediately begin managing packages from the terminal.
Using Command Prompt
This method is ideal if you're already working in a Command Prompt environment. It uses PowerShell internally to execute the Chocolatey installation script.
Open Command Prompt as Administrator.
- Press
Win + X
and select Command Prompt (Admin).
- Press
Run the following command:
pwsh@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Using PowerShell
This method is best for users comfortable with PowerShell or those planning to automate installation across systems. It explicitly sets the execution policy to allow script execution.
Open PowerShell as Administrator.
- Press
Win + X
and select Windows PowerShell (Admin).
- Press
Run the following command:
pwshSet-ExecutionPolicy Bypass -Scope Process -Force; ` [System.Net.ServicePointManager]::SecurityProtocol = ` [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ` iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
After installation, verify Chocolatey is installed.
choco --version
You should see output similar to:
0.12.1
Chocolatey Command Options
Command | Description |
---|---|
choco install <pkg> |
Installs the specified package |
choco install <pkg1> <pkg2> |
Installs multiple packages in one go |
choco upgrade <pkg> |
Upgrades the specified package |
choco upgrade all |
Upgrades all installed packages |
choco uninstall <pkg> |
Uninstalls the specified package |
choco list --local-only |
Lists all locally installed Chocolatey packages |
choco pin add -n=<pkg> |
Pins a package to prevent upgrades |
choco pin remove -n=<pkg> |
Removes the pin from a package |
choco info <pkg> |
Shows details about the specified package |
choco install packages.config |
Installs packages from a config file |
Managing Packages with Chocolatey
Once installed, Chocolatey makes managing software on Windows effortless. You can install, upgrade, and uninstall software packages using intuitive commands. This section explains how to handle individual and bulk operations to simplify your software management workflow.
Installing Packages
Installing packages with Chocolatey is as simple as typing a single command. Whether you're installing one application or provisioning an entire environment, the same syntax applies.
To install a package, open an elevated Command Prompt or PowerShell window and run:
pwshchoco install <package-name> -y
You can also install multiple packages in a single command to streamline setup:
pwshchoco install <package1> <package2> <package3> -y
Upgrading Packages
Upgrading software is just as simple. You can upgrade individual packages or all packages at once, ensuring your system stays current with the latest versions.
To upgrade a specific package:
pwshchoco upgrade <package-name> -y
To upgrade all installed packages:
pwshchoco upgrade all -y
Uninstalling Packages
Uninstallation is just as seamless as installation. Whether you're removing a single tool or cleaning up multiple outdated programs, Chocolatey handles it cleanly from the terminal.
To uninstall a package, run the following command from an elevated Command Prompt or PowerShell session:
pwshchoco uninstall <package-name> -y
Listing Installed Packages
Need to see what's already installed? Chocolatey can list all managed packages, giving you a snapshot of your current environment.
To view all installed packages:
pwshchoco list --local-only
Advanced Usage and Tips
Chocolatey also supports advanced functionality such as pinning versions, exporting configurations, and batch installation from config files. These features are useful for power users, administrators, and automation workflows.
Pin a Package Version
Prevent a package from being upgraded.
choco pin add -n=<package-name>
To remove a pin.
choco pin remove -n=<package-name>
Export Installed Packages
Generate a list of installed packages.
choco list --local-only > packages.config
Install Packages from Config File
Install packages listed in a configuration file.
choco install packages.config
View Package Information
Get detailed information about a package.
choco info <package-name>
Conclusion
In this article, you learned how to install and use Chocolatey, a package manager for Windows that simplifies software deployment and maintenance. You explored multiple installation methods using Command Prompt and PowerShell, installed and removed packages using simple commands, and explored advanced functionality such as version pinning and config-based batch installation.
To explore more functionality, including upgrade options, version pinning, and advanced flags, run: choco /?
or visit the official Chocolatey documentation for in-depth guidance and package development tips.
No comments yet.