echo set GAME_DIR=%GAME_DIR%>gamedir.bat
echonl set GAME_DIR=>temp2.bat
stripext %1>>temp2.bat
echo.>>temp2.bat
call temp2.bat
goto check_gamedir
:reget_gamedir
if exist temp2.bat del temp2.bat
echo.
call gamedir.bat
rem Previous line in case GAME_DIR was set and user aborts
echonl type>temp3.bat
echosp >>temp3.bat
stripext %1>>temp3.bat
echo .dat>>temp3.bat
call temp3.bat
echonl --
echonl ">"
echosp
echonl set GAME_DIR=>temp3.bat
askutil>>temp3.bat
if errorlevel 1 goto end
call temp3.bat
if "%GAME_DIR%"=="" echo Skipped!
if "%GAME_DIR%"=="" goto end
if not exist %QUAKE_DIR%\%GAME_DIR%\nul echo Error finding game dir, make sure you don't include a trailing backslash.
:check_gamedir
if not exist %QUAKE_DIR%\%GAME_DIR%\nul goto reget_gamedir
if not exist temp2.bat goto asked
echo.
echonl type>temp3.bat
echosp >>temp3.bat
stripext %1>>temp3.bat
echo .dat>>temp3.bat
call temp3.bat
echonl --
echonl ">"
echo Installing %1 into directory %QUAKE_DIR%\%GAME_DIR%
del temp2.bat
:asked
echo vispatch pak?.pak -dir %QUAKE_DIR%\%GAME_DIR%\ -data %1 %NEW%>>runpatch.bat
echo vispatch *.bsp -dir %QUAKE_DIR%\%GAME_DIR%\maps\ -data %1 %NEW%>>runpatch.bat
rem set up the installer
:end
call gamedir.bat
rem Sets whatever gamedir user had before
del gamedir.bat
if exist temp2.bat del temp2.bat
if exist temp3.bat del temp3.bat
rem If user ctrl-c'd the input
