command redirection

command redirection

Post by George M. » Thu, 05 Feb 2004 13:33:34

Using the > operator one can independently redirect the output from CONOUT$
and CONERR$ to separate files or devices. For example, one can do something
like this:

myprogram.exe > output.txt 2> error.txt.

What I want to do is to independently pipe the output from CONOUT$ and
CONERR$ to separate programs. I want to do something like this:

myprogram.exe | firstprogram.exe 2| secondprogram.exe

But that doesn't seem possible. Am I wrong?



command redirection

Post by Gary Chans » Thu, 05 Feb 2004 14:47:42


I don't believe that it is possible.


-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)


command redirection

Post by Luc Kump » Thu, 05 Feb 2004 16:41:28

The standard command-line processor (CMD.EXE) won't allow this.
But using the technique described in
one could easily write a program which does this, e.g. accepting three
command line parameters (myprogram.exe, firstprogram.exe and

Luc K

command redirection

Post by yhhuan » Fri, 06 Feb 2004 16:01:16

Hi George,

Thanks for your post.

I agree with Luc on it. Using CreateProcess API and you can redirect
standard output and error output of your program to a file stream or a
pipe. That KB article has a detailed sample on it. I think what Gary meant
is this is not possible in command line.

If there is anything unclear, please feel free to post here.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure!
This posting is provided "AS IS" with no warranties, and confers no rights.