@echo off
if "%1"==":" if not "%2"=="" goto %2
Title AutoRun (debug-mode)
rem
rem DebugRun (Startup Group for BartPE & Nu2Menu)
rem Copyright (c) 2003-2004 Erwin Veermans (http://www.veder.com/nwdskpe/)
rem

echo.
echo AutoRun Debug Mode
echo.

if not exist %SystemRoot%\System32\Keydown.exe goto _done

rem Pre-Default Group  
for %%i in (%SystemRoot%\System32\autorun1*.cmd %SystemRoot%\System32\autorun2*.cmd) do call %0 : _ask %%i /wait /min
for %%i in (%SystemRoot%\System32\autorun3*.cmd %SystemRoot%\System32\autorun4*.cmd) do call %0 : _ask %%i /wait /min
rem Default Group
for %%i in (%SystemRoot%\System32\autorun5*.cmd %SystemRoot%\System32\autorun_*.cmd) do call %0 : _ask %%i /wait /min
rem Post-Default Group
for %%i in (%SystemRoot%\System32\autorun6*.cmd %SystemRoot%\System32\autorun7*.cmd) do call %0 : _ask %%i /wait /min
for %%i in (%SystemRoot%\System32\autorun8*.cmd %SystemRoot%\System32\autorun9*.cmd) do call %0 : _ask %%i /wait /min
rem Post Default Concurrent Group (no /wait)
for %%i in (%SystemRoot%\System32\autorun0*.cmd) do call %0 : _ask %%i /min
goto _done

:_ask
shift
shift
echo Would you like to run '%1' [Y/N]?
%SystemRoot%\System32\Keydown.exe 0
if not "%errorlevel%"=="121" if not "%errorlevel%"=="89" goto _end
start "%1" %2 %3 %4 %5 "%1"
goto _end

:_done
echo.
echo AutoRun Done
echo.
pause
exit
goto _end

:_end
