我想在多个具有多个参数的窗口中启动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}
}
可能有人建议如何指定多个参数
答案 0 :(得分:1)
尝试Start-Process
cmdlet:
Start-Process powershell -ArgumentList "-NoExit -File c:\test.ps1",$arg1,$arg2,$arg3