[英]Passing a response file to a process in Powershell
我有一个传统上会这样运行的过程(在命令行中):
filepath.exe @“ respfile.resp”
其中respfile.resp是具有可执行文件命令行参数的响应文件。
在命令提示符下按需要运行这样的命令。
但是,我试图使用Powershell脚本来运行多个程序。 这是我所拥有的:
if (Test-Path $respPath){
$executionResposne = Start-Process -NoNewWindow -Wait -PassThru -FilePath $bimlcExePath -ArgumentList $respPath
if ($executionResposne.ExitCode -eq 1){
Write-Output "Unable to successfully run the process. Exiting program."
return
}
}
并且我收到以下错误消息:
Error:: filepath\to\resp\file Data at the root level is invalid.
我该如何进行这项工作?
您需要嵌入解释器的引号:
-ArgumentList "@`"$respPath`""
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.