I know cmd > file.txt to record an output of a command to a file in Windows!.

Does anybody know how to run a batch script recording the output to a file AND also showing the output on the command prompt as well when executed?

link|improve this question

62% accept rate
feedback

1 Answer

up vote 2 down vote accepted

You'll need a Windows-based implementation of tee to do this. Here are some options:

If you don't require output in situ, you can "cheat" by piping the commands, but this is not nearly as useful as following stdout in real-time.

cmd >file.txt | type file.txt

link|improve this answer
I thought of using your easy method cmd >file.txt | type file.txt but it's showing the copy percentage as 0%(not updating) till the end. I'm trying to install wintee, didn't get correct link yet. Trying... – user53864 Jul 23 '11 at 5:58
@user53864 Yes, the redirection+pipe doesn't work quite like tee, as the first command must complete entirely before the type will occur. The code.google.com link in my answer is a working version of wintee -- is it non-functional for you? – jscott Jul 23 '11 at 10:38
That wintee.exe just opening and staying like a statue when I double clicked to execute it. – user53864 Jul 23 '11 at 12:40
@user53864 It is a command-line program, not a windowed one. Try wtee.exe --help for usage. Using your question's example, you'd want to do cmd | wtee.exe file.txt to see the output on stdout as well as redirect it to file.txt. – jscott Jul 23 '11 at 12:47
Oh...no. Actually I was using cmd | tee file.txt instead of cmd | wtee file.txt. That was my mistake which you corrected it. I thought I should install wtee.exe file by double clicking it but as you said it's not and instead should directly place it under system32. Thanks a lot!! – user53864 Jul 23 '11 at 15:44
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.