I open a command prompt window in XP. There I run a command line program (foo.exe) and I want to capture stdout in a file. So I run it like this:

foo > fooResult.txt

However, at the same time I would like stdout to still be fed to the screen of the command prompt window. What is the syntax for that?

link|improve this question
feedback

2 Answers

foo |teefooResult.txt

link|improve this answer
Does this work out of the box in windows? – Nathan Fellman May 26 '10 at 18:42
You need the tee executable, which is available at the link given. – Ignacio Vazquez-Abrams May 26 '10 at 19:00
feedback

If you were using Linux you could use tee, like this:

foo | tee fooResult.txt

This would do what you want. Unfortunately (in this sense only, lest I upset somebody), you're using Windows. Fortunately, there is a windows version of tee here or here.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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