how to log cmd output to file & display it on the screen

Thread Starter

KMK

Joined Feb 11, 2010
69
hi,

i need a way to log the output of command prompt in a file & at the sam time, the executed command should be displayed on screen.

Eg. when i issue ping command, it should display the ping results on screen realtime & log the same to a file.
 
Last edited:

djsfantasi

Joined Apr 11, 2010
9,163
Search online for "tee.exe for Windows". I don't know which base OS (Windows server versus Windows 7 for example) you are using, but this is the command you're looking for.

Then, pipe the output from your command (e.g., "ping") to tee and specify your output file. Output will go to both the screen (standard output) and the file.

Ping 127.0.0.1 | tee pingout.txt
 
Last edited:

Thread Starter

KMK

Joined Feb 11, 2010
69
im using Windows XP & 7. Are there any commands in the CMD of the OS that can be used for this prupose, without having to install the "tee.exe" ?
 

djsfantasi

Joined Apr 11, 2010
9,163
No. Tee is a simple servlet, which I installed as a package of Linux shell tools to extend Windows cmd commands. But you only need the one command.
 
Top