Debugging Challenge
Remember batch? (Batch)
1 min readMay 4, 2020
Previously on Dr. Lambda’s blog: I have devised a series of debugging challenges, some are easy, some are really hard, all come from real live systems. Good luck!
The Challenge
- 1 point if you can spot where the error is.
- +1 point if you can explain why.
- +2 points if you can explain how to fix it.
@Echo off
set direct=1
echo %cmdcmdline% | find /i "%~n0" >nul
if not %errorlevel% == 1 set direct=0
REM powershell.exe -file .\AdHocScripts\FlushBlobCache.ps1
Set e=%errorlevel%
if not %e% == 0 goto error
powershell.exe -Version 2 -file .\AdHocScripts\FarmIISReset.ps1
Set e=%errorlevel%
if not %e% == 0 goto error
goto success
:error
Echo ERROR, errorlevel %e%
if %direct% == 0 pause else exit %e%
goto end
:success
Echo done
if %direct% == 0 pause
:end