Does psexec support input redirection?

佐手、 提交于 2020-01-04 19:47:33

问题


I am trying to control a remote Python script via psexec, which reads commands from stdin, but I need to redirect psexec's input since psexec itself will be launched from another program. However, I have no luck making psexec accept redirected input. Is it supposed to work at all?

An example of what I'm trying to do, where input is a file containing input to the remote script:

psexec \\mymachine python c:\script.py < input

回答1:


Here's one way I was able to kinda accomplish what you're after:

PsExec.exe -d \\\\192.168.1.1 cmd /k "echo list volume | diskpart"

This would pass the commands "list volume" to the diskpart command. Additionally you can also try using cmd like this for you example:

PsExec.exe -d \\\\192.168.1.1 cmd /k "python c:\script.py < input"



来源:https://stackoverflow.com/questions/4508363/does-psexec-support-input-redirection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!