如何远程运行 Windows 批处理内部命令?

Ale*_*lex 1 windows remote-desktop batch command-line

我有两个Windows计算机AB,我想远程运行计算机上的命令B。我使用该工具psexec,因此A我可以在计算机上运行:

psexec.exe \\10.0.0.2 -u user -p pasword c:\programs\whatever\commando.exe
Run Code Online (Sandbox Code Playgroud)

在计算机上执行命令B。这么好这么好。

但是如何简单地dir在远程计算机上运行,这是一个内部批处理命令?

 psexec.exe \\10.0.0.2 -u user -p pasword dir
Run Code Online (Sandbox Code Playgroud)

只是给

The system cannot find the file specified.
Run Code Online (Sandbox Code Playgroud)

Kin*_*tus 5

试试这个例子:

psexec \\10.0.0.2 -u user -p pasword -s cmd /c dir c:\
Run Code Online (Sandbox Code Playgroud)

关键是cmd /c访问cmd shell

来源:http : //ss64.com/nt/psexec.html