Using Chocolatey Package Manager on Windows

Published on: Fri, Oct 5, 2018 at 5:06 pm EST

Introduction

Chocolatey brings package management that makes administering software and dependencies easy on Linux, to Windows.

You can quickly and easily deploy software packages and tools to a new Windows machine in just a few steps. Chocolatey's simple and familiar syntax is easy to learn and can save heaps of time when setting up a new environment.

Installing Chocolatey

Using cmd.exe

Open an administrative command prompt (right-click Start -> Command Prompt (administrator)) and type the following command:

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

Using PowerShell.exe

Open an administrative PowerShell prompt (right-click Start -> Windows PowerShell (administrator)) and type the following command:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

Installing packages

There are hundreds of packages that can be browsed through on the Chocolatey website https://chocolatey.org/packages or by running:

choco list

Some common server and development packages available through Chocolatey include:

  • hMail Server
  • Java Server Runtime Encironment
  • Filezilla Server
  • SQL Management Studio
  • FreeSSHd
  • Telerik Fiddler

To install a package, open an administrative command prompt or PowerShell session and type the following command:

choco install <packagename> -y

Any dependencies will also be installed automatically. You can also include multiple packages in one command to minimize waiting:

choco install visualstudiocode fiddler googlechrome -y

Uninstalling packages/Chocolatey

Packages are removed similarly to how they are installed. Simply run the following command to uninstall your chosen package:

choco uninstall <packagename>

You can even uninstall Chocolatey inteself with this command:

choco uninstall chocolatey

Additional options

For additional command line options, run Chocolatey with the /? command line switch:

choco /?