[英]Executing program on remote with Powershell
我無法在遠程服務器上執行程序。 這是我的命令
$appCommand = "`"c:\SIDApps\{0}\{1}.exe`"" -f $destinationDirectory, $processToKill
Invoke-Command -ComputerName $remoteComputer -Credential $credentials -ScriptBlock { $args[0] } -ArgumentList $appCommand
在輸出窗口中打印出"c:\\SIDApps\\FFMBC_Drone\\GCUKTransCodeServiceFFMBCApp.exe"
(包括引號),但實際上並未執行程序
如果僅在ScriptBlock
輸出$args[0]
,它將僅顯示不運行命令的路徑。
你試過這個嗎?
$appCommand = "c:\SIDApps\{0}\{1}.exe" -f $destinationDirectory, $processToKill
Invoke-Command -ComputerName $remoteComputer -Credential $credentials -ScriptBlock { Start-Process $args[0] } -ArgumentList $appCommand
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.