簡體   English   中英

使用Powershell遠程執行程序

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

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM