Outputting batch file error output

barraymian

Distinguished
May 23, 2011
1
0
18,510
Hi all,

A novice here.

I have a very simple batch file and I would like to write only its stderr output to a txt file. The batch file contains only one line

mxmlc filename

I know that I don't need a batch file for this but I don't have any control over that part of the program.

so I know can do the following

mxmlc filename 2>>error.log

However, the file error.log will get created even if there was no error generated from the script.

I know I can use errorlevel but then I won't know what the error was. Somehow I need to capture the output from the command and then check for errorlevel and if error level is 1 then I can output the error to a log file, otherwise I don't need to write anything to error.log

thanks