It is a common requirement to allow the exporting of all the packages that are currently installed on one computer, to enable them to be easily installed onto another computer.
Since Chocolatey GUI 0.13.0 added an export button, and Chocolatey CLI 0.11.0 added the export command, this has been possible using a packages.config
file.
A packages.config
file is an XML file, which stores information about the package ID, and optionally a package version. An example packages.config
file would be:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="calibre" version="7.16.0" />
<package id="chocolatey" version="2.3.0" />
<package id="chocolatey.extension" version="6.2.1" />
<package id="chocolatey-core.extension" version="1.4.0" />
</packages>
Once created, this packages.config
file can be used along with the choco install command, to perform the installation of each package contained within the file.
choco install <path-to-exported-file>
Enhancements to the packages.config
file
There are several ideas around how the packages.config
file can be extended to further enhance the ability to export the list of installed Chocolatey packages.
For example, there is a GitHub issue, currently slated for the next Chocolatey CLI release, which would include the ability to export the arguments that were used during the initial installation of the package.
An example of what this would allow would be:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="iperf2" prerelease="true" ignoreDependencies="true" forceX86="true" installArguments="/test" overrideArguments="true" applyInstallArgumentsToDependencies="true" packageParameters="/test" applyPackageParametersToDependencies="true" allowDowngrade="true" timeout="0" failOnStderr="true" useSystemPowershell="true" />
<package id="Wget" />
<package id="z3" packageParameters="/z3param" forceX86="true" />
</packages>
During installation, these additional arguments would be respected, and passed into the installation of the correct package.
This is a very exciting addition to Chocolatey CLI, and I personally am very much looking forward to this being available.
If you have any suggestions to how this particular command can be enhanced, I invite you to reach out via our Community Hub, as I would love to hear your ideas!
Summary
With the aid of two Chocolatey CLI commands, it is possible to make one computer match another in terms of the Chocolatey packages that are installed.
choco export --include-version-numbers
Followed by:
choco install <path-to-exported-file>
Your new computer will now install all the packages listed in the packages.config
file, using the included package parameters!
If you have any follow-up questions, check the export command documentation page, or reach out for community assistance on our Community Hub.
Popular Tags
- #news 69 Number of post with tag news
- #press release 56 Number of post with tag press release
- #chocolatey for business 44 Number of post with tag chocolatey for business
- #packaging 21 Number of post with tag packaging
- #open source 17 Number of post with tag open source
- #community 15 Number of post with tag community
- #tutorial 14 Number of post with tag tutorial
- #12 days of Chocolatey 2023 12 Number of post with tag 12 days of Chocolatey 2023
- #chocolatey community repository 12 Number of post with tag chocolatey community repository
- #podcast 11 Number of post with tag podcast