The wrong way to call a dodgy PowerShell script with an array of arguments
# This is an alternative way of calling .\echo.ps1 --hello=World --bonjour=Monde
# also see https://octopus.com/blog/dynamic-argument-list-when-calling-executable-from-powershell
$script = ".\echo.ps1"
$args = @()
$args += "--hello"
$args += "World"
$args += "--bonjour"
$args += "Monde"
# the result is that echo.ps1 will only get one argument :-(
& $script $args
# this is a somewhat dodgy way of using arguments in PowerShell
# it would be much nicer to use proper Powershell parameters
Write-Host "The script args are..."
foreach($arg in $args) {
Write-Host $arg
}