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?


foo |teefooResult.txt


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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