Last active
September 6, 2017 17:13
-
-
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"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.