Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

How can I redirect output to a text file and the console (cmd) window at the same time?

share|improve this question
up vote 7 down vote accepted

Powershell 2.0 comes with the Tee-Object cmdlet which does exactly that. If you're using Windows 7, it comes with Powershell 2.0 installed. If you're using an older version of Windows, Powershell 2.0 is available for download.

The benefit of Powershell is that it can run the commands that cmd can as well.


dir | Tee-Object -file c:\output\dir.txt
share|improve this answer

There's a good answer for an identical question on StackOverflow

In summary, find a Win32 port of the Unix tee command.

share|improve this answer
Hehe. I posted here as I thought would moved if I posted on StackOverflow. I'll mark this as the answer if I don't find an alternative :) – Thomas Bratt Feb 17 '10 at 14:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .