Skip to content

Instantly share code, notes, and snippets.

@beaujackson
beaujackson / chocolateyInstall.ps1
Created December 8, 2016 19:26
Using command line parameters within chocolateyInstall.ps1
<#
The parsePackageParameters function allows you to call choco install like this:
choco install MyChocolateyPackage --params '/myParam: ""some parameter with spaces in it""'
#>
function parsePackageParameters($packageParameters) {
$arguments = @{}
if ($packageParameters) {
# The input string is something like this, and we will use a Regular Expression to parse the values
# /Port:81 /Edition:LicenseKey /AdditionalTools