is there a way to channel STDERR and STDOUT to different programs?

advertisements

For example I need to set two tee commands in such way that one will be reading from STDOUT and second from STDERR and both redirecting the console output to different files. Is such thing possible in windows batch files ? I know about how to redirect output to file but in this case it won't be displayed on screen or how to combine both streams but how about piping both independently ?


You may process STDOUT and STDERR with separate programs via the next trick:

(test | findstr /N /A:2A "^" ) 2>&1 1>&3 | findstr /N /A:4E "^"

Previous line show STDOUT output preceded by green numbers and STDERR output preceded by red ones. Just use your TEE program instead findstr...

If you have not an adequate TEE program for Batch files, you may find one here: Displaying Windows command prompt output and redirecting it to a file