TL;DR
Install Chocolatey in admin-shell:
@"%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"Start installing right away:
> cinst nodejs -y
Do you know how we used to install new software on our computer back in the days of Windows 3.1x/95? How do you do it now?
Allow me to answer that.
A Brief History
Back in the days, we used to get new software on a floppy, and it contained an executable which we ran. As simple as that.
But with time, software became more large and complex (and floppies gave way to CDs, which gave way to DVDs), and they needed more than just an executable file - they needed .ini files, they needed an entry in the registry and what not. So, instead of just an executable, now we had installers. These installers would create all the folders and registry entries for the software. They also came with uninstallers - which would properly cleanup your computer while removing the software.
But there was one catch - if the installer broke or crashed while installing or uninstalling, your computer was left with a bunch of orphaned files and registry entries.
So, Microsoft introduced a standard API for installers called the Windows Installer. [1] But, that only solved one part of the problem - packaging the software. What about distribution?
As I mentioned already, initially the software was distributed on external media, starting from floppies, then CDs and DVDs. But with the advent of fast internet connections, the internet has become the primary mode of distributing software.
But, as a consumer, downloading from the internet comes with its own challenges. How do you trust the source? How do you know that the download is indeed the software you are looking for and not malware in disguise?
The Need for an Automated Installer
What was needed here was a single and trusted repository for all the software - and a tool to query and download that software from the repository. It’s not a new concept and the folks using Unix like operating systems have already been using tools like this (apt, yum, dnf, pkg etc).
But in the world of Windows, we had nothing until Windows Store was introduced. [2] But even with a store, the one thing that’s missing is that its all GUI based, and replicating a set of installed software to another machine is not possible.
Why would I need that you say?
Well, suppose you are a lead developer in your team. You need a suite of applications and tools to build your application - VS Code, NodeJS, git, python, ruby, and whatnot. Then comes a new developer in your team and you ask him/her to get all these applications. What this new developer has to do now is to go through your checklist, search for that tool on the internet, find out where to download it, and then download and install it - while making sure the correct version is installed.
This is okay if your developer’s ecosystem just needs a couple of tools. But if your ecosystem needs tens of tools, this quickly becomes cumbersome and error-prone.
Introducing Chocolatey
Chocolatey is the missing software management solution for Windows. According to its website:
Chocolatey was created by Rob Reynolds in 2011 with the simple goal of offering a universal package manager for Windows. Chocolatey is an open source project that provides developers and admins alike a better way to manage Windows software.
I cannot emphasize how much I wanted something like this in Windows until I came across Chocolatey. And it behaves exactly like you want it to behave - simple and intuitive - as long as you are comfortable in running commands from DOS prompt or PowerShell.
Installing Chocolatey
I must admit - the only quirky thing about Chocolatey is its own installation. Chocolatey sticks to its theme of using the command line for installation by suggesting that we install the software itself using the command line(PowerShell, to be exact). Also, it is highly recommended that you install Chocolatey from an administrative shell. [3]
The simple way is to run the following command in your cmd.exe, a.k.a., DOS Prompt. [4] This will automatically launch PowerShell and download and run the installation script for you:
@"%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"You should see an output similar to this:
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.15.
Extracting D:\Users\...\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to D:\Users\...\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
(i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.
Creating Chocolatey folders if they do not already exist.
WARNING: You can safely ignore errors related to missing log files when
upgrading from a version of Chocolatey less than 0.9.9.
'Batch file could not be found' is also safe to ignore.
'The system cannot find the file specified' - also safe.
WARNING: Not setting tab completion: Profile file does not exist at 'D:\Users\...\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder
>_Managing Packages
Once you have installed Chocolatey, you can start installing softwares from your command line:
> choco install nodejsYou should see an output similar to this:
Chocolatey v0.10.15
Installing the following packages:
hugo
By installing you accept licenses for the packages.
Progress: Downloading hugo 0.69.2... 100%
hugo v0.69.2 [Approved]
hugo package files install completed. Performing other installation steps.
The package hugo wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint):_Hit Y and ENTER to continue.
Do you want to run the script?([Y]es/[A]ll - yes to all/[N]o/[P]rint): y
Downloading hugo 64 bit
from 'https://github.com/gohugoio/hugo/releases/download/v0.69.2/hugo_0.69.2_Windows-64bit.zip'
Progress: 100% - Completed download of D:\Users\...\AppData\Local\Temp\chocolatey\hugo\0.69.2\hugo_0.69.2_Windows-64bit.zip (13.01 MB).
Download of hugo_0.69.2_Windows-64bit.zip (13.01 MB) completed.
Hashes match.
Extracting D:\Users\...\AppData\Local\Temp\chocolatey\hugo\0.69.2\hugo_0.69.2_Windows-64bit.zip to C:\ProgramData\chocolatey\lib\hugo\tools...
C:\ProgramData\chocolatey\lib\hugo\tools
ShimGen has successfully created a shim for hugo.exe
The install of hugo was successful.
Software installed to 'C:\ProgramData\chocolatey\lib\hugo\tools'
Chocolatey installed 1/1 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
>_You can avoid the prompt in the installation step by using the flag |
But installing a couple of softwares one after another is no fun! So you can also install multiple softwares from a single command.
> cinst nodejs git nginx -yBut typing all these software names in command prompt is also not my idea of fun! What we can have is a config file, which lists all the softwares I need, and asks Chocolatey to use that configuration file.
Here is what my configuration file looks like:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="7zip" />
<package id="conemu" />
<package id="cygwin" />
<package id="fiddler" />
<package id="firefox" />
<package id="git" />
<package id="golang" />
<package id="googlechrome" />
<package id="hugo" />
<package id="meld" />
<package id="mobaxterm" />
<package id="msys2" />
<package id="nginx" />
<package id="nodejs" version="12.14.1"/> (1)
<package id="notepadplusplus" />
<package id="pandoc" />
<package id="postman" />
<package id="procexp" />
<package id="python" />
<package id="python2" />
<package id="ruby" />
<package id="slack" />
<package id="strawberryperl" />
<package id="visualstudiocode" />
<package id="xsltproc" />
</packages>| 1 | Note that you can also mention the version of the package like in the case of nodejs. |
Once you have the configuration file, you can ask Chocolatey to use this configuration file:
> choco install packages.config -yRemember the new guy/gal in the team? Just give him/her this configuration file and him/her to use Chocolatey.
Now I can rest easy knowing that the ecosystem on the new developer’s machine will match my ecosystem and the new developer would not have to spend time surfing around websites to download the tools!
Chocolatey GUI
For those who despise the command line, Chocolatey also has a nice GUI tool. But the catch is that you have to install this tool via the command line.
> choco install ChocolateyGUIYou can launch the GUI from your Start Menu, and you will have this:

Other Options
Let me point out that Chocolatey is an excellent software management tool, but it’s not the only one out there. The two most prominent ones are:
While the free version of ninite just was not enough for me, the limited repository of just-install failed to impress me.
.msi