Is there a way to redirect ONLY stderr to stdout (not combine the two) so it can be piped to other programs

Posted by James K on Stack Overflow See other posts from Stack Overflow or by James K
Published on 2012-09-05T02:47:50Z Indexed on 2012/09/05 3:38 UTC
Read the original article Hit count: 102

Filed under:
|
|

I'm working in a Windows CMD.EXE environment and would like to change the output of stdout to match that of stderr so that I can pipe error messages to other programs without the intermediary of a file.

I'm aware of the 2>&1 notation, but that combines stdout and stderr into a single stream.

What I'm thinking of would be something like this:

program.exe 2>&1 | find " "

But that combines stdout and stderr just like:

program.exe | find " " 2>&1

I realize that I could do...

program 2>file
type file | find " "
del file

But this does not have the flexibility and power of a program | find " " sort of notation. Doing this requires that program has finished with it's output before that output can be processed.

© Stack Overflow or respective owner

Related posts about Windows

Related posts about batch