Install Apps And Programs From Command Line Using Chocolatey

Installing applications and programs on your Windows computer just became much easier. Rather than running individual .EXE files…

Command Line Chocolatey

Installing applications and programs on your Windows computer just became much easier. Rather than running individual .EXE files to install applications, and then going through the installation wizard, you can install an app or program using the command line with a single cmdlet.

Microsoft released the Winget command line package manager a few years back, which can be used to install, remove, and upgrade apps and programs on a Windows PC directly from Command Prompt or Windows PowerShell. However, there were a few limitations with the tool, which is why today we will talk about Chocolatey – a third-party package manager.

This post illustrates why it is convenient to use Chocolatey instead of Winget, and how to use it to make our lives easier and install applications with a single cmdlet.

What is Chocolatey

Chocolatey is a command-line package manager that automates the processes involved in installing, uninstalling, and upgrading applications on your computer. Not only that, but it can also obtain and perform many other functions using the different parameters, which we have discussed further down this post.

A package manager uses the information inside a package, which usually includes software binaries, configuration files, images and icons, and other metadata. The manager is then responsible for using that data and correctly performing the assigned task.

Chocolatey uses its own vast library of application packages that are basically modified NuGet packages to install and upgrade applications. Since it has its own library, the available packages can be browsed through here. This package repository also gives the cmdlets needed to install, uninstall, or upgrade the different apps.

But how is Chocolatey different from Winget? Let’s find out.

Winget VS Chocolatey

As we mentioned, Winget had a few limitations to its installation capabilities, which Chocolatey does not.

Winget only supports the following types of installation packages:

  • EXE
  • INNO
  • NULLSOFT
  • MSI
  • APPX
  • MSIX
  • BURN

However, Chocolatey supports the following packages on top of the ones supported by Winget:

  • Binary packages
  • PowerShell command packages
  • Development (.DEV) packages
  • Roadmap (Virutal packages)

Other than this, Chocolatey may be the wiser choice because of these facts:

  • You often have to make a few clicks here and there when using Winget to install an app.
  • The unisntallation process f Chocolatey is more reliable as it does not leave out any dependencies.
  • Winget is occasionally unable to upgrade installed applications.

With these few issues in Winget, we would suggest you opt for Chocolatey to manage your apps and programs. Let us now address the elephant in the room and discuss how to install and use Chocolatey. But before you do, ensure your system meets these minimum requirements.

Prerequisites for Chocolatey

  • Operating System: Windows 7 or Server 2003 and above.
  • PowerShell Version 3 or above.
  • .NET 4 or above.

How to Install Chocolatey

Chocolatey can be installed using both the Command Prompt as well as Windows PowerShell.

From PowerShell

Perform the following steps to install Chocolatey using PowerShell:

  1. Open PowerShell with administrative rights.
  2. Now set the script execution policy to AllSigned using this cmdlet:
    Set-ExecutionPolicy AllSigned
    AllSigned
  3. To confirm, enter A.
    all
  4. Now paste the following scrip in PowerShell to install Chocolatey:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
  1. Chocolatey will now be installed.
    pwsh 1If asked for a confirmation, enter A.

You can then confirm that Chocolatey has been installed by navigating to the following using File Explorer:

C:\ProgramData\chocolatey

From Command Prompt

If you would rather prefer the Command Prompt, here is how to install it:

  1. Open the Command Prompt with administrative privileges.
  2. Now paste the following command to begin installing Chocolatey:
@"%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://community.chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
  1. Chocolatey will now install.
    cmd 3
    Once the installation completes, close the Command Prompt and then reopen it use Chocolatey.

You can use the cmdlet choco -? to see what commands you can use with Chocolatey.

choco
View Chocolatey commands

Chocolatey is now successfully installed. Let us now show you how to use it.

Chocolatey Packages

Before we move on to installing any apps, we ought to know what can be installed and what can’t, since only the packages in the Chocolatey repository can be installed.

For that, you can open the Chocolatey packages library and search from the top of the page for your desired app.

Search for Chocolatey packages
Search for Chocolatey packages

If you find your desired app, you can click on it to obtain more information, such as whether a reboot may be required, if the package has been scanned for malware, etc.

Information on Chocolatey package
Information on Chocolatey package

If you scroll down, you will also find the different tabs labeled Install, Upgrade, and Uninstall. These tabs state the cmdlet needed to perform the task for this particular package.

Commands to perform tasks
Commands to perform tasks

Alternatively, you can also search for an app using this cmdlet in PowerShell or Command Prompt while replacing AppName with the keyword for the app:

Choco Search AppName
search 2
Search for app with Chocolatey from command line

Let us now continue to see how to use Chocolatey to manage apps and programs from the command line.

How to Install Application using Chocolatey

To install an app, you must use the following cmdlet once Chocolatey has been installed using the guide given above in elevated Command Prompt or PowerShell:

Choco Install PackageName

You must replace PackageName with the name of the app. If there is confusion, you can refer to the Chocolatey package repository and look for the installation cmdlet. Here is an example:

Choco Install adobereader
install 4
Installing app using Chocolatey

The respective application will now be installed and is ready to use.

How to Upgrade Application using Chocolatey

To upgrade an installed application, use the following cmdlet in elevated Command Prompt of PowerShell:

Note: If an app is not already installed when running the upgrade cmdlet, Chocolatey will automatically install the app and its update.

Choco Upgrade PackageName

You must replace PackageName with the name of the app. Here is an example:

Choco Upgrade microsoft-edge
upgrrade
Application upgraded with Chocolatey

How to Unisntall Application using Chocolatey

Uninstalling an app with Chocolatey is just as convenient as installing one. Use the following command in elevated Command Prompt or PowerShell while replacing PackageName with the name of the app that you want to remove:

Choco Uninstall PackageName

Here is an example:

Choco Uninstall adobereader
uninstall 1
Uninstall app using Chocolatey

Closing Words

Chocolatey is an excellent command-line utility that saves time and can automate the installation/uninstallation process without having the user make any clicks. This is especially useful if the same applications need to be installed on bulk devices.

Chocolatey can perform many other operations using the different switches, such as list outdated applications so you can upgrade them, get information on a specific package, fetch other package information, etc.

After using Chocolatey, would you ever go back to Winget? If so, then why?

Also see:

Subscribe to our Newsletter

Get the latest tech news, advice and downloads in your inbox

Leave a Reply

You have to agree to the comment policy.