psexec,cmd和批处理 [英] Psexec, cmd and batch
本文介绍了psexec,cmd和批处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Hello.
I have a batch file named a.bat on a winserver2008 Desktop.
That batch file only write the SessionID (from environment variable) to a local eventlog.
I want to execute it remotely using cmd (otherwise the SessionName doesn't appear).
so I have tried
<code>c:\PsTools\psexec.exe \\<Server> -u test2 -p <Password> -i 2 cmd "c:\Users\test-2\Desktop\a"</code>
or
<code>c:\PsTools\psexec.exe \\<server> -u test2 -p <Password> -i 2 "cmd \"c:\Users\test-2\Desktop\a\"";exit</code>
all of these just open a terminal on the remote machine but don't execute the batch.
Any ides?
Best Regards,
推荐答案
尝试以下方法:
psexec.exe \\<Server> -u test2 -p <Password> -d -i "c:\Users\test-2\Desktop\a.bat"
Try this:
psexec.exe \\<Server> -u test2 -p <Password> -d -i "c:\Users\test-2\Desktop\a.bat"
这篇关于psexec,cmd和批处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文