Solved .txt output of batch screen

June 20, 2011 at 20:44:10
Specs: Windows XP
I am using batch to run a folder full of python scripts over the weekend

FOR %%x IN (*.py) DO call "%%x"

Occasionally, one of the .py files does not work, gives and error on the command prompt window, and then moves on to the next .py. I would like a print (output to .txt) of the batch session so that I can tell which .py did not work.

It seems that the redirect command (> or >>) would only transfer command output to particular place. My batch command (call) does not have any output and simply executes. Is there a way to get and output of everything that happened during a batch session? It would mimic alt+print screen or cut and paste of a command window. Thanks,

See More: .txt output of batch screen

Report •

June 21, 2011 at 08:29:24
✔ Best Answer
Stated CALL is used to run a batch script and return to the calling one, so in the reported case you would code just

  for %%x in (*.py) do "%%x"

you may try the following to redirect in a log the stderr output

for %%x in (*.py) do "%%x" 2>> python.log

Report •

June 21, 2011 at 19:31:47
2>>batch.log works to output errors only to a text file, which is fine.

Report •

Related Solutions

Ask Question