Useful .bat for programmers

It allows you to get console application output both viewable and into .txt file. Here it is:
REM start of code
@echo off
setlocal enabledelayedexpansion
set outfile=%1
:loop
set /p line=
if defined line (
echo !line!
echo !line!>>%outfile%
goto loop
)
REM end of code

On my PC, I named it tee.bat because it simulates the Tee command. Use it using:
your_program.exe | tee.bat output.txt

Hope it helps!
 
Back
Top