Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

foo |teefooResult.txt

share|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
Or on a new console, if he has Cygwin. – Lorenzo Von Matterhorn Sep 16 '13 at 10:25

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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