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?

Regards,

George.
 
 
 

command redirection

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


CONOUT$
something

I don't believe that it is possible.

--

-GJC [MS Windows SDK MVP]
-Software Consultant (Embedded systems and Real Time Controls)
- http://www.yqcomputer.com/
XXXX@XXXXX.COM

 
 
 

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
http://www.yqcomputer.com/
one could easily write a program which does this, e.g. accepting three
command line parameters (myprogram.exe, firstprogram.exe and
secondprogram.exe)

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! www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.