繁体   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