1

On Windows when running a batch script I want to record the output of I run:

myprogram.bat 1> mylog.log 2>&1

Which is great - but I have to run a separate tail process to read the output in another window. What I want is to be able to record it to a file and see it in the window all at once.

Now on a mac I can do this with:

./a.out 2>&1 | tee output

My question is: How do I pipe stdout and std error to a file and back to stdout on Windows?

Hawkeye
  • 2,669
  • 9
  • 30
  • 34

1 Answers1

0

I do not think that is possible. You can either use a 3rd-party tool, such as WinTee:

myprogram.bat | wintee "mylog.log"

or switch to PowerShell and use Tee-Object cmdlet:

.\myprogram.bat | Tee-Object "mylog.log"