:: TestBatch.cmd :: :: - by Nick @ FoolishIT.com [Foolish IT LLC] :: - Official Download: https://download.foolishit.com/BatchFiles/TestBatch.cmd.txt :: :: Created: 4/17/07 :: Last edit: 4/17/07 :: :: Required OS: NT-based :: :: See where your batch is going wrong. Generate a log! :: :: Drag and Drop the batch file you wish to test on this batch file. :: Alternately, you could start your batch as a parameter to this one. :: :: BE SURE TO TURN THE ECHO ON in the batch file you wish to test to :: log everything and get the full effect. :: :: When testing batch that calls code in different batch files, you may :: need to make additional modifications to each batch you are actually :: trying to run. (e.g. turn ECHO ON as stated above in each.) :: :: Console output of your original batch will be disabled during this :: test so know well where your "any key" and/or input prompts are. :: @echo off&cls&title %0&echo Preparing to run your batch file, please wait... set fileloc="%~dp1" :: pushd %fileloc% set inputerror= set reportfile= set today= set now= set xret= set xmsg= set testfile=%~nx1 set fulltestfile=%1 set reportnameonly=%~nx1--report.txt set reportfile="%~dp0%reportnameonly%" echo Testing batch file: "%~nx1" > %reportfile% echo File location: "%~dp1" >> %reportfile% echo File Attributes: "%~a1" >> %reportfile% echo File Size: "%~z1 bytes" >> %reportfile% echo Creation/Mod date: "%~t1" >> %reportfile% echo Full 8.3 path/name: "%~s1" >> %reportfile% echo Command Line: %1 %2 %3 %4 %5 %6 %7 %8 %9 >> %reportfile% echo "%~n0" called from: "%~dp0" >> %reportfile% echo, >> %reportfile% >> %reportfile% echo --------------------------------------------------------- >> %reportfile% echo Operation started on: %date% - %time% >> %reportfile% echo Output of "%~nx1" follows: >> %reportfile% echo --------------------------------------------------------- >> %reportfile% cls&echo Testing your backup batch file now... @echo on shift call %fulltestfile% %1 %2 %3 %4 %5 %6 %7 %8 %9 >> %reportfile% 2>&1 @echo off for /f "tokens=1,2,3,4 delims=/ " %%a in ('date /t') do set today=%%b.%%c.%%d for /f "tokens=1,2,3,4 delims=: " %%a in ('time /t') do set now=%%a.%%b.%%c echo, >> %reportfile% echo --------------------------------------------------------- >> %reportfile% echo Operation ended on: %date% - %time% >> %reportfile% echo End of output. >> %reportfile% echo, >> %reportfile% echo "%testfile%" file contents are as follows: >> %reportfile% echo --------------------------------------------------------- >> %reportfile% echo. >> %reportfile% type %fulltestfile% >> %reportfile% echo. >> %reportfile% echo. >> %reportfile% echo --------------------------------------------------------- >> %reportfile% echo END OF REPORT >> %reportfile% :: notepad %reportfile% ren %reportfile% %reportnameonly%-%today%-%now%.txt set inputerror= set fileloc= set reportfile= set today= set now= set xret= set testfile= set fulltestfile= set xmsg=