更新时间:2023-02-03 21:10:57
在编写 invoke-command
是Powershell命令时,因此必须调用Powershell tu来运行该命令,如下所示:
As you wrote invoke-command
is a Powershell command, thus you have to call Powershell tu run the command like so:
Process p = new ProcessBuilder()
.inheritIO()
.command("powershell", "invoke-command", "-computername", "compName",
"-filepath", "C:\\script.ps1").start();