Take the 2-minute tour ×

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

2 Answers 2

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, 

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


