@title Error logging with redirects @echo off :: set is used to make the letter L = logfile.txt and can be called with %L% set L=logfile.txt :: call the LOG section of the script. call :LOG :LOG echo Logged time = %time% %date% > %L% 2>&1 adb.exe devices >> %L% 2>&1 >> %L% 2>&1 echo App Install = Pass echo App Install = Pass >> %L% 2>&1 echo App Install = Pass >> %L% 2>&1 echo App Install = Pass >> %L% 2>&1 echo App Install = Pass >> %L% 2>&1 echo App Install = Pass >> %L% 2>&1 pause exit