Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

share|improve this question
add comment

2 Answers

up vote 4 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.

Example:

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

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
add comment

Your Answer

 
discard

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.