Windows – Does psexec support input redirection

pstoolswindows

I am trying to control a remote Python script, which reads commands from stdin, via psexec 1.98, 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

Best Answer

The issue is that it thinks that "...script.py" is the end of your command. If you put quotes around it

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

Then you should be fine.

Additionally, you'll probably need to specify an absolute path to that input file.

Two examples:

psexec \\mymachine python "c:\script.py < \\input_file_server\input"
OR
psexec \\mymachine python "c:\script.py < c:\input"

That should do it for you.