Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a list of packages from one machine and install in another with Chocolatey?

Tags:

chocolatey

Calling clist -l gives me a list of packages with versions:

7zip.install 16.04 ccleaner 5.28.6005 ConEmu 17.3.16.0 ... 

How do I get this list without version information?

My intention is to use this output to call choco install 7zip.install ccleaner ConEmu ... on another machine. An alternative answer could be how to use the output of clist directly into cinst.

like image 471
Natan Avatar asked Apr 02 '17 10:04

Natan


People also ask

How do I check my Chocolatey packages?

Packages are installed in C:\ProgramData\chocolatey\lib (or in $env:ChocolateyInstall ). See what is in there.

Where are Choco packages stored?

Chocolatey packages are installed to ChocolateyInstall\lib , but the software could go to various locations, depending on how the package maintainer created the package. Some packages are installed under ChocolateyInstall\lib , others - especially packages that are based on Windows installers (.

How do I install Chocolatey globally?

Go to https://community.chocolatey.org/packages/chocolatey and find a version you want. Click on Download to download that version's nupkg file.

What is Choco command?

Chocolatey or Choco as it is sometimes referred to, is a free, open-source package manager for Windows that is very similar to Apt or DNF in the Linux realm. In other words, this is a program used for installing software via the Windows command line.


1 Answers

If you have a look at the help information for the choco install command (you can do this using choco install -h, you will find the following usage:

cinst <pkg|packages.config> [<pkg2> <pkgN>] [<options/switches>] 

As you will see, it is possible to pass a packages.config file, which would contain all the packages that you want to install. The format of this packages.config file is very simple and looks like the following:

<?xml version="1.0" encoding="utf-8"?> <packages>   <package id="calibre" version="2.81.0" />   <package id="chocolatey" version="0.10.3" />   <package id="chocolatey.extension" version="1.9.6" />   <package id="chocolatey-core.extension" version="1.1.0" /> </packages> 

Once you have this file, installing all the packages again on another machine is a simple one line command.

A simple way to generate this packages.config file would be to install ChocolateyGUI (choco install chocolateygui), which includes an option to export the currently installed list of applications.

like image 139
Gary Ewan Park Avatar answered Sep 29 '22 18:09

Gary Ewan Park