当我传递脚本文件和参数
时,我无法使用start-process调用powershellstart-process powershell d:\startTask.ps1 "param1" "param2" "param3"
我的startTask.ps1如下所示
param([string]$x="default",[string]$y="default",[string]$z="default")
echo "x: $x"
echo "y: $y"
echo "z: $z"
答案 0 :(得分:2)
尝试:
Start-Process Powershell -ArgumentList "-noexit","-File d:\startTask.ps1 param1 param2 param3"
答案 1 :(得分:1)
& powershell d:\startTask.ps1 "param1" "param2" "param3"