Chocolatey is a package manager for Windows. It allows you to install software for Windows with a simple command, without having to find and install the software for Windows individually.

Install Chocolatey

To install chocolate, you must install it by running cmd or PowerShell.

When using cmd

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE% \chocolatey\bin

When using powershell

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

Find package

Just go to the web page below and search.

https://chocolatey.org/packages

Or you can do a search using search or list command in cmd.

> choco search googlechrome
Chocolatey v0.10.15
GoogleChrome 79.0.3945.117 [Approved] Downloads cached for licensed users
vivaldi.install 2.10.1745.23
... skip
10 packages found.

For example, if you search the Google Chrome web browser, 10 packages will appear. Just search chrome and a list of over a hundred packages will appear.

To see exactly the packages you need here, you need to add the -e or --exact option.

> choco search googlechrome -e
Chocolatey v0.10.15
GoogleChrome 79.0.3945.117 [Approved] Downloads cached for licensed users
1 packages found.

And, in some cases, you may need to install a specific version of a package. In that case, to check the version, enter the -a, --all option to check the version information.

View package details

You can use info command or add -v option in search.

However, it works as if the -e option was added to the info command search.

> choco info googlechrome
Chocolatey v0.10.15
GoogleChrome 79.0.3945.117 [Approved] Downloads cached for licensed users
 Title: Google Chrome | Published: 2020-01-07
 Package approved as a trusted package on 1 08 2020 01:22:22.
... skip

or

> choco search googlechrome -ev
Chocolatey v0.10.15
GoogleChrome 79.0.3945.117 [Approved] Downloads cached for licensed users
 Title: Google Chrome | Published: 2020-01-07
 Package approved as a trusted package on 1 08 2020 01:22:22.
... skip

Here, an option is given with -ev, which is a summary form of -e -v in one.

Installing packages

Install the package you want to install using the install command as shown below.

> choco install bandizip
Chocolatey v0.10.15
Installing the following packages:
bandizip
... skip
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):

When the command prompt appears, press y to complete the installation.

If you want to press y automatically during installation, just add the -y option. And if you want to force installation, you can put -f.

> choco install -yf bandizip

If you want to install a specific version, you can install it using the --version option.

choco install bandizip --version=6.24

Deleting packages

Chocolatey can be easily removed from the installed package by using the uninstall command.

> choco uninstall bandizip
Chocolatey v0.10.15
Uninstalling the following packages:
bandizip
... skip
Do you want to run the script?([Y]es/[A]ll-yes to all/[N]o/[P]rint):

When prompted, press y to delete.

If it is troublesome to press the y key, you can immediately delete it by pressing -yf as in the installation.

> choco uninstall -yf bandizip

Check the list of installed packages with choco

You can check with search or list command. If -l option is given afterwards, a list of locally installed packages is displayed.

> choco search -l
bandizip 6.25
... skip
zeal 0.6.1
zeal.install 0.6.1
62 packages installed.

Or, you can search using clist command.

> clist -l

The clist command acts like choco search.

Updating the package

You can update the package to the latest version through the upgrade command.

> choco upgrade bandizip

If you want to update all installed programs through choco, you can put all instead of the package name.

> choco upgrade all

Herbal script from chocolatey installation to package installation

Create a file called choco_install.bat and copy and insert the contents below.

Then, put the package you want to install at the back.

@echo off
CLS
ECHO **************************************
ECHO * Start Chocolatey Batch
ECHO **************************************

::::::::::::::::::::::::::::::::::::::::::
:: Check and get admin privileges
NET FILE 1>NUL 2>NUL
if'%errorlevel%' == '0' (goto gotPrivileges) else (goto getPrivileges)

:getPrivileges
::::::::::::::::::::::::::::::::::::::::::
:: Using UAC to switch to administrator privileges
if'%1'=='ELEV' (shift & goto gotPrivileges)
ECHO.
ECHO **************************************
ECHO * Use UAC, switch to admin
ECHO **************************************

setlocal DisableDelayedExpansion
set "batchPath=%~0"
setlocal EnableDelayedExpansion
ECHO Set UAC = CreateObject^("Shell.Application"^)> "%temp%\OEgetPrivileges.vbs"
ECHO UAC.ShellExecute "!batchPath!", "ELEV", "", "runas", 1 >> "%temp%\OEgetPrivileges.vbs"
"%temp%\OEgetPrivileges.vbs"
exit /B


:gotPrivileges
::::::::::::::::::::::::::::::::::::::::::
:: Getting Started
setlocal & pushd.

WHERE choco 1>NUL 2>NUL
if'%errorlevel%' == '0' (goto chocoInstalled) else (goto chocoMissing)

:chocoMissing
::::::::::::::::::::::::::::
:: Install without Chocolatey
:::::::::::::