rsk82
rsk82

Reputation: 29377

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

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 ?

Upvotes: 0

Views: 1154

Answers (2)

Aacini
Aacini

Reputation: 67196

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

Upvotes: 3

foxidrive
foxidrive

Reputation: 41224

You can redirect stdout and stderr to different files but that's about as far as it goes.

If the make output can be time coded on every line then the two files could be adjusted and re-interleaved.

Upvotes: 0

Related Questions