0

我想在具有多个参数的多个窗口中启动一个 powershell 脚本

foreach($Instance in $config){

    $MaxSamples = $UserInput.MaxSamples
    $SampleInterval = $UserInput.SampleInterval
    $instance = $Instance

        cmd /c start powershell -NoExit -Command {.\sqlcounters.ps1 $instance $SampleInterval $MaxSamples $OutputDirectory $Instance_$MaxSamples_iterations_with_db}

}

有人可以建议如何指定多个参数

4

1 回答 1

1

试试Start-Processcmdlet:

Start-Process powershell -ArgumentList "-NoExit -File c:\test.ps1",$arg1,$arg2,$arg3
于 2013-03-27T10:11:31.560 回答