3
我有一個PROGRAMM我通常這樣開始在PowerShell中:啓動此參數的背景.exe文件在PowerShell腳本中
.\storage\bin\storage.exe -f storage\conf\storage.conf
什麼是調用它在後臺正確的語法?我嘗試了很多組合,例如:
start-job -scriptblock{".\storage\bin\storage.exe -f storage\conf\storage.conf"}
start-job -scriptblock{.\storage\bin\storage.exe} -argumentlist "-f", "storage\conf\storage.conf"
但沒有成功。它也應該在PowerShell腳本中運行。
命名參數版本的外觀如何?我已經使用$ args來調用腳本,所以我不能使用args數組。 – mles
您仍然可以使用參數。它在腳本塊中有一個新的作用域(它將用於作業的另一個powershell.exe實例中),但是我已更新以顯示命名參數。 –
啊好的。現在我遇到了另一個問題。你也可能知道這一個? http://stackoverflow.com/questions/15769126/expand-variable-in-block – mles