Link to home
Get AccessLog in
Avatar of charland
charland

asked on

DOS Redirect to Screen and file. STDOUT and STDERR

Without any programming can I redirect the output of a command to both a file and the screen.

I want to do something like:-

IPCONFIG >Ip.log >CON

And see the result of the command as well as the output going into IP.log. I've read the post regarding the duplicate handle
ability - but this just isn't making sense as to how this helps my (simple) requirement.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
simple but tedious fix:
IPCONFIG
IPCONFIG >Ip.log >CON

one for screen, one for file!
I'm sure you'll get a cleverer answer than this tho.
Danny
Avatar of DrWarezz
DrWarezz

There's loads of ways, but I think that you'll need to refer to an external app to do them both at the exact same time.

You could do something in one line:

IPCONFIG & IPCONFIG > IP.log

Or, this would actually be the quickest way:

IPCONFIG > Ip.log & type Ip.log

:-)

gL,
[r.D]
Avatar of charland

ASKER

Sorry - I'm only using IPCONFIG as an example - the actual command might be a script that can only run once and the person running the script wants to see it's progress.

So - TEE does the job - I guess there is this utility for a reason.

Can anyone see any use of native dos redirect that does what tee does?

Points awarded soon.
>"So - TEE does the job - I guess there is this utility for a reason."
Well, this command:
IPCONFIG > Ip.log & type Ip.log
Does the job. It outputs the data to the file, then isntantly reads the file to the screen. If you test it, you'll find that it's very quick, and a good method of doing this task. Oh, and best of all, it doesn't require you downloading an external app. :-)

>"Can anyone see any use of native dos redirect that does what tee does?"
Not that I know of.


[r.D]
DrWarezz - No because my previous comment does say that we want to 'see it's progress'.