[英]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.