Skip to content

Instantly share code, notes, and snippets.

@Nilzor
Last active September 6, 2017 17:13
Show Gist options
  • Save Nilzor/e2f4541b67d74276a641 to your computer and use it in GitHub Desktop.
Save Nilzor/e2f4541b67d74276a641 to your computer and use it in GitHub Desktop.
A script that converts list of programs output by "choco list" to an XML file parsable by choco installer. Run with 'choco list -lo | chocoProgramListToXml.ps1"
$xml = "<?xml version=`"1.0`" encoding=`"utf-8`"?>`n"
$xml += "<packages>`n"
foreach ($program in $input) {
$name, $version, $shouldBeEmpty = $program.Split(" ")
if (!$shouldBeEmpty) {
$xml += (" <package id=`"{0}`" version=`"{1}`"/>`n" -f $name,$version)
}
}
$xml += "</packages>`n"
echo $xml
@harvzor
Copy link

harvzor commented May 8, 2015

Very nice. However, I can't help but feel that there should be a feature of Chocolatey to output this sort of file by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment