Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

Installing and Uninstalling Packages

Let’s get a run of all Chocolatey-hosted packages and display them in grid view. Figure 2 shows the output.

Figure 2

Figure 2 Browsing the Chocolatey repository for interesting PowerShell packages.

We already know that the WinRAR archiver exists in the repo; let’s take advantage of the PowerShell pipeline to install it on our local system:

Find-Package -Name WinRAR | Install-Package -Verbose
VERBOSE: Performing the operation "Install Package" on target "Package ’winrar’ v’5.20.1’ from’chocolatey’".

The package ’winrar’ comes from a package source that is not marked as trusted.
Are you sure you want to install software from ’chocolatey’?
[Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"):

If you want to keep the Chocolatey repository as untrusted, you can either press Enter to continue at the prompt, or supply the -Force parameter.

As Figure 3 shows, WinRAR is indeed installed. (This is the evaluation copy, of course; you don’t get fully licensed commercial software free from Chocolatey.)

Figure 3

Figure 3 We installed this graphical application in mere seconds with Windows PowerShell.

We use Get-Package to verify installed software. If you run Get-Package with no parameters, you’ll see all the software on your system. Let’s get a better view:

Get-Package -ProviderName Chocolatey

Name      Version      Status       ProviderName     Source           Summary
----      -------      ------       ------------     ------           -------
winrar    5.20.1       Installed    Chocolatey       C:\Chocolatey... WinRAR is a powe...

To remove a package, we’ll combine the pipeline with the Remove-Package cmdlet:

Get-Package -Name winrar | Uninstall-Package -Force
  • + Share This
  • 🔖 Save To Your Account