Windows Command Line – Redirect Output to Text File While Also Seeing Output

command linestdoutwindows

I'm writing a C program in Windows, my printf calls print to the command line, and I know that I can redirect all this output to a text file using:

myProgram.exe > mylog.txt

However, I wish to also see the output that would have been printed to the console as well as log all of it in a text file.

Is there a way to do this? I was thinking of using tail to monitor the log file.

Best Answer

The windows PowerShell has a tool that can do that, named tee after the unix tool which does the same.

Alternatively, there are ports of the unix tee for windows: