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

Is it possible to redirect output to multiple devices/files?

program.exe 1> output1.txt 1>output2.txt

This only produces output2.txt in Windows.

share|improve this question

tee is a command that offers you the flexibility on *nix machines to redirect output to multiple files.

From the man page -

     The tee utility copies standard input to standard output, 
making a copy in zero or more files.  The output is unbuffered.

On Windows, you can use something similar to this.

share|improve this answer

If you're using a Unix/Linux shell, or Cygwin on Windows, you can use tee to copy stdin to multiple output files:

program.exe | tee output1.txt >output2.txt

Not sure if there's a tee equivalent in native Windows cmd.exe.

Most shells, such as bash, let you combine stdout and stderr. Here's the syntax to merge stdout and stderr from program.exe and pipe it into tee. 2>&1 says to redirect the output of file descriptor 2 (stderr) to file descriptor 1 (stdout)

program.exe 2>&1 | tee output1.txt >output2.txt
share|improve this answer
Help says it will only copy standard stream. Is it possible to copy stderr stream with tee? – ShyMan Nov 29 '11 at 3:24
Yes it's possible. I added stderr to the example. – cantfork Nov 29 '11 at 12:58

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.