If you are someone who finds a headache in going through the monotonous process of installing an application on your Windows and would die for an alternative solution, you have come to the perfect place. In this article, we introduce you to Chocolatey, a package manager, that you can easily set up in your Windows. Once this package manager is set up in your machine, you can install almost all the applications right from your Command Prompt or from your PowerShell. More than the ease factor, Chocolatey indeed gives you a techy aura; it’s command prompt after all!
Read on, to learn all about Chocolatey and how you can efficiently utilize it to make your life easier.
Section 1: What is Chocolatey
Chocolatey is a command-line package manager that automates the entire process of software installation in your machine. You can use both PowerShell and Command Prompt to run Chocolatey commands. The best thing about Chocolatey is that it is free and it is open source. There are many things that Chocolatey can do. Using Chocolatey, we can install and uninstall packages, we can upgrade existing applications, search for a specific application from thousands of applications available from the Chocolatey software repository and many more. We can also check for the list of outdated software in our machine using Chocolatey.
Section 2: How to Install Chocolatey Package Manager
Chocolatey can be used both from Command Prompt and from Windows PowerShell. In this section, we explain how you can install Chocolatey on your machine. The installation process of Chocolatey can also be done either by using PowerShell or by using Command Prompt.
Method 1: Through PowerShell
Step 1: Click on the Search icon on the Taskbar.
Step 2: Now in the PowerShell search bar, type in PowerShell and click on the Run as Administrator option as shown below.
Step 3: When the PowerShell window opens up, firstly we need to make sure that the execution policy is not restricted. To view the execution policy set in your machine, copy and paste the following command and hit the Enter key.
Step 4: If the result of the previous steps comes as Restricted, then you need to execute the next command as well, else you can skip this step and move on to Step 5.
After executing the command, press Y or y and hit the Enter key to confirm the execution policy change.
Step 5: As next, let’s execute the command that would install Chocolatey on our machine.
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Copy and paste the above command and then hit the Enter key.
Step 6: Wait while Chocolatey gets installed in your machine. Once installed, your PowerShell screen would like the screenshot below.
Step 7: Now open File Explorer and navigate to the following path to see the Chocolatey folder in your machine.
This PC --> Local Disk (C:) --> ProgramData --> Chocolatey
Alternatively, you can copy and paste the location C:\ProgramData\chocolatey onto your File Explorer navigation bar and hit the Enter key to reach the same location.
This is the location where Chocolatey gets installed in your machine. If you can see this folder, it means that installation is a success and that it’s a thumbs up for you to go ahead and start exploring Chocolatey features.
Step 8: Get back to the PowerShell window and copy & paste the following command to see all the Chocolatey commands available.
So that’s how you install Chocolatey through the PowerShell window. Now if you would like to install it via Command Prompt, you can follow the steps below.
Method 2: Through Command Prompt
Step 1: As usual, click on the Search icon on the taskbar.
Step 2: Now in the search bar, type in cmd and click on the Run as Administrator option against Command Prompt.
Step 3: When Command Prompt opens up in elevated mode, copy and paste the following command to install Chocolatey in your machine.
@"%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"
Hit the Enter key to execute the command.
That’s it. The above command would install Chocolatey in your machine. Wait a little while for it to run to completion.
Note: I already have Chocolatey in my machine, that’s why I’m getting the following screen. However, for you, if you haven’t gotten Chocolatey in your machine already, it would get installed with the command in Step 3.
Step 4: Once the installation is complete, you can copy and paste the following command to see the list of things that Chocolatey can do for you.
Section 3: What are Chocolatey Packages and Where Can you See the Package Repository
Chocolatey packages contain all the data about the packages and they contain some additional data as well, that are specific to Chocolatey. It is using the Chocolatey packages that we install applications in our machine. Chocolatey has a huge package repository where it houses thousands of packages. All the packages available at the Chocolatey repo have been thoroughly validated, verified and checked for viruses. There are many more checks performed by Chocolatey that make the packages even more secure as well.
Click here to see the Chocolatey package repository. The package repository website is highly useful when it comes to many things. Some of them are listed below.
3.1 Search for Packages
By using the package repository search bar, you can search for packages.
3.2 Find Install Command for Packages
If you scroll down through the webpage, you can see many packages, against each you will be able to find its installation command.
3.3 Find Uninstall Command for Packages
Firstly click on the package that you want to find the uninstall command for.
On the package-specific webpage, scroll down to find the section named Deployment Method: Individual Install, Upgrade, & Uninstall.
Here, you have to click on the tab named Uninstall to view the uninstall command.
3.4 Find Upgrade Command for Packages
For this one also, firstly click on the package that you want to find the upgrade command for.
Once you are at the package page, scroll down and find the section named Deployment Method: Individual Install, Upgrade, & Uninstall.
Here click on the tab named Upgrade. Here, you will be able to see the Upgrade command readily.
3.5 How to Find Whether a Package has Passed the Chocolatey Tests
Firstly enter the package-specific webpage. You can do this by clicking on the package name from the home page of the package repository webpage.
Now, on the package-specific webpage, at the top itself, you will be able to see whether the package has passed all the verifications and validations.
Section 4: How to Install Windows Software Using Chocolatey from Command Prompt or Powershell
Now that you have Chocolatey in your machine, let’s see how you can use it to install different applications using Chocolatey. You can use both Command Prompt and PowerShell to execute the Chocolatey commands. In this article, we are using PowerShell for the same. You can open PowerShell or Command Prompt window as detailed in Section 1.
Step 1: To install any software, you can use the following command:
choco install [package name]
You have to replace [package name] with the name of the package that you want to install.
In the example below, I’m installing Adobe Reader using Chocolatey. So my command would be choco install adobereader. If you have any confusion about the package name, you can refer to Section 3 and get the installation command for the application you want, straight from the Chocolatey package repository website using the search bar.
Once you have the command ready, hit the Enter key.
Type y or Y whenever you are asked to confirm something like Do you want to run the script?
Step 2: Once the installation is complete, Chocolatey would tell you so.
That’s it. You can now open the installed software using your windows search bar just like how you would launch any software. Oh yes, it can’t get simpler than this. Enjoy!
Section 5: How to Uninstall Windows Software Using Chocolatey from Command Prompt or Powershell
To uninstall an application using Chocolatey, the command would be in the following format.
choco uninstall [package name]
Replace [package name] with the actual package name. You can follow Section 3.3 to find the uninstall command for the package readily.
Section 6: How to Search for a Package Using Chocolatey from Command Prompt or Powershell
Just like how you can search for a package using the package repository website, you can search for a package straight from Command Prompt or PowerShell as well.
The command to search for a package would be of the following format.
choco search [search keyword]
You have to replace [search keyword] with your actual keyword.
For example, if you want to search for packages with the keyword reader, then your search command would be choco search reader.
Executing this command would list all the packages available, in the Chocolatey package repository, that have the keyword reader in their package name.
Section 7: How to Upgrade an Application Using Chocolatey from Command Prompt or Powershell
Upgrading an application cannot get any simpler when Chocolatey is all set to help you. In the PowerShell or Command Prompt window, execute the upgrade command to upgrade a package.
The upgrade command for any package would be of the following format.
choco upgrade [package name]
Please remember to replace [package name] with the actual package name. If you are confused about how the upgrade command would be for a particular package, you can refer to Section 3.4.
An example is given in the following screenshot where Chocolatey would upgrade the package named adobereader.
Section 8: How to See the List of Outdated Packages Using Chocolatey
You also have the option to see the complete list of outdated software that are installed through Chocolatey. The command for the same is as follows.
If there are some outdated Chocolatey packages, Chocolatey would list them through this command and if there are no outdated packages, then you would get a message from Chocolatey saying Chocolatey has determined 0 package(s) are outdated.
So, that’s all about Chocolatey. But of course, there is a lot more about Chocolatey that you can explore. If you find more useful and cool tips and tricks on Chocolatey, please do share them with us in the comments section.
Hope you found the article useful.