Page 1 of 1

Redirection Question

Posted: 28 Sep 2011 22:09
by alleypuppy
Is it possible to redirect the output of a command to a file and still read the output of the command in the CMD window as it's executing? I know you can redirect output using

Code: Select all

[command] > [file] 
or
[command] >> [file]

but it always nullifies the output on the screen.

Thanks for any help!

Re: Redirection Question

Posted: 29 Sep 2011 00:01
by Ed Dyreen
'
That would be great, I tried something similar in the past:

Code: Select all

> "file.TMP" echo.This Works
< "file.TMP" set /p $str=
echo.$str=%$str%_
But some assembly wizard, could easily write a COM to do this, not me though. I just have a wild imagination:

Code: Select all

echo.This Works |STREAM.COM "File.TMP"

Re: Redirection Question

Posted: 29 Sep 2011 21:20
by alleypuppy
Ed Dyreen wrote:'
That would be great, I tried something similar in the past:

Code: Select all

> "file.TMP" echo.This Works
< "file.TMP" set /p $str=
echo.$str=%$str%_

Hmmm... that works, but what if the command prompts you to do something? It is only shown after the command completes.

Re: Redirection Question

Posted: 30 Sep 2011 09:03
by dbenham
You want the equivalent of the Unix tee utility. There is no native Windows equivalent (unless you use PowerShell).

There are many ports of Unix utilities available for Windows, some of them free. I think the GnuWin CoreUtils for Windows package has a tee that will work.

Dave Benham