我们需要从 Linux 机器到 Windows 10 远程执行带有参数的 .exe。所以我们在 CentOS 中安装了 PowerShell。以下是我们使用的命令:
Invoke-Command -HostName abcdefg -Credential $creds -ScriptBlock { Start-Process -FilePath "C:\sip\GetProcessInstance.exe" -$args[0] } -ArgumentList "http://hostname:8080/jbpm-console/rest/task/listUserTasks?potentialOwner=abc@xyz.com"
Invoke-Command -HostName abcdefg -Credential $creds -ScriptBlock { Start-Process -FilePath "C:\sip\GetProcessInstance.exe" -ArgumentList "http://hostname:8080/jbpm-console/rest/task/listUserTasks?potentialOwner=abc@xyz.com" }
Invoke-Command -HostName abcdefg -Credential $creds -ScriptBlock { Get-ChildItem C:\ }
收到以下错误
Invoke-Command:无法使用指定的命名参数解析参数集。发出的一个或多个参数不能一起使用或提供的参数数量不足。
在行:1 字符:1
同样适用于 Windows 到 Windows。