I have this function in PowerShell:
function Run-Process
{
param([string]$proc_path, [string[]]$args)
$process = Start-Process -FilePath $proc_path -ArgumentList $args -PassThru -Wait
$exitcode = Get-ExitCode $process
return $exitcode
}
And in some code elsewhere, I call it thusly:
$reg_exe = "C:\WINDOWS\system32\reg.exe"
$reg_args = @("load", "hklm\$user", "$users_dir\$user\NTUSER.DAT")
$reg_exitcode = Run-Process -proc_path $reg_exe -args $reg_args
When it's called, $proc_path gets the value for $reg_exe, but $args is blank.
This is how array parameters are passed in Powershell, isn't it?