1.

Solve : .txt output of batch session?

Answer»

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 (ie, dir) to particular place. My batch command (ie, 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,

Have you tried REDIRECTING the batch output to a FILE?

Mybatch.bat > report.txt

Mybatch.bat > report.txt generally just creates a blank .txt file.

Some other posters have suggested a error or output log 1>>output.log or 2>>error.logYou can print the errors and standard output to a single file by using the "&1" command to redirect the output for STDERR to STDOUT and then sending the output from STDOUT to a file:

Mybatch.bat 1> output.msg 2>&1



Discussion

No Comment Found