0

当我同时传递脚本文件和参数时,我无法使用启动进程调用 powershell

start-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"
4

2 回答 2

2

尝试:

Start-Process Powershell -ArgumentList "-noexit","-File d:\startTask.ps1 param1 param2 param3"
于 2012-11-09T12:15:05.507 回答
1
& powershell d:\startTask.ps1 "param1" "param2" "param3"
于 2012-11-09T12:22:00.997 回答