这不起作用:
$server = "server";
$cmd = "hostname";
C:\Users\ss\Documents\Scripts\PSTools\PsExec.exe \\$server $cmd;
但这会:
$server = "server";
C:\Users\ss\Documents\Scripts\PSTools\PsExec.exe \\$server hostname;
为什么?
答案 0 :(得分:0)
尝试附加&到命令的前面:
&安培; C:\ Users \ ss \ Documents \ Scripts \ PSTools \ PsExec.exe \ $ server $ cmd;