Make uninstaller a self-extractable

This commit is contained in:
mazmazz 2018-12-04 11:17:08 -05:00
parent 7b1423a236
commit decb22dabd
7 changed files with 119 additions and 92 deletions

View file

@ -2,6 +2,7 @@
*.* *.*
!staging !staging
!sfx !sfx
!uninstaller
!! MAKE SURE FILES ARE IN new-install ARCHIVE FOLDER !.txt !! MAKE SURE FILES ARE IN new-install ARCHIVE FOLDER !.txt
!BuildInstaller.bat !BuildInstaller.bat
!README.txt !README.txt

View file

@ -1,3 +1,5 @@
@echo off
set "SCRIPTDIR=%~dp0" set "SCRIPTDIR=%~dp0"
set "SCRIPTDIR=%SCRIPTDIR:~0,-1%" set "SCRIPTDIR=%SCRIPTDIR:~0,-1%"
@ -7,13 +9,9 @@ IF [%SRB2VERSIONNAME%] == [] set /p SRB2VERSIONNAME=<"%SCRIPTDIR%\VersionFileNam
set SVZIP= set SVZIP=
if [%1] == [] ( if NOT [%1] == [] (
echo.
) else (
echo.%~1 | findstr /C:"7z" 1>nul echo.%~1 | findstr /C:"7z" 1>nul
if errorlevel 1 ( if NOT errorlevel 1 (
echo.
) else (
if exist "%~1" set "SVZIP=%~1" if exist "%~1" set "SVZIP=%~1"
) )
) )
@ -24,56 +22,55 @@ if ["%SVZIP%"] == [""] (
if exist "%ProgramW6432%\7-Zip\7z.exe" set "SVZIP=%ProgramW6432%\7-Zip\7z.exe" if exist "%ProgramW6432%\7-Zip\7z.exe" set "SVZIP=%ProgramW6432%\7-Zip\7z.exe"
) )
:: Is it in PATH?
if ["%SVZIP%"] == [""] (
"7z.exe" --help > NUL 2> NUL
if NOT errorlevel 1 (
set "SVZIP=7z.exe"
)
)
:: Create the uninstaller
if NOT ["%SVZIP%"] == [""] (
del /f /q "%SCRIPTDIR%\Uninstaller.7z" 2> NUL
"%SVZIP%" a -t7z "%SCRIPTDIR%\Uninstaller.7z" "%SCRIPTDIR%\uninstaller\*" -m5=LZMA2
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-uninstaller.txt" + "%SCRIPTDIR%\Uninstaller.7z" "%SCRIPTDIR%\staging\new-install\uninstall.exe"
del /f /q "%SCRIPTDIR%\uninstaller.7z"
)
:: Operate on install archives :: Operate on install archives
type NUL > "%SCRIPTDIR%\staging\new-install\staging.txt" type NUL > "%SCRIPTDIR%\staging\new-install\staging.txt"
if exist "%SCRIPTDIR%\Installer.7z" ( if exist "%SCRIPTDIR%\Installer.7z" (
if ["%SVZIP%"] == [""] ( if NOT ["%SVZIP%"] == [""] (
echo. "%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\staging\*"
) else (
cd "%SCRIPTDIR%\staging"
"%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\staging\new-install"
"%SVZIP%" a "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
cd "%SCRIPTDIR%"
) )
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Installer.exe" copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Installer.exe"
) )
if exist "%SCRIPTDIR%\Patch.7z" ( if exist "%SCRIPTDIR%\Patch.7z" (
if ["%SVZIP%"] == [""] ( if NOT ["%SVZIP%"] == [""] (
echo. "%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\staging\*"
) else (
cd "%SCRIPTDIR%\staging"
"%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\staging\new-install\"
"%SVZIP%" a "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
cd "%SCRIPTDIR%"
) )
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Patch.exe" copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-Patch.exe"
) )
if exist "%SCRIPTDIR%\Installer_x64.7z" ( if exist "%SCRIPTDIR%\Installer_x64.7z" (
if ["%SVZIP%"] == [""] ( if NOT ["%SVZIP%"] == [""] (
echo. "%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\staging\*"
) else (
cd "%SCRIPTDIR%\staging"
"%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\staging\new-install\"
"%SVZIP%" a "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
cd "%SCRIPTDIR%"
) )
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Installer.exe" copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-installer.txt" + "%SCRIPTDIR%\Installer_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Installer.exe"
) )
if exist "%SCRIPTDIR%\Patch_x64.7z" ( if exist "%SCRIPTDIR%\Patch_x64.7z" (
if ["%SVZIP%"] == [""] ( if NOT ["%SVZIP%"] == [""] (
echo. "%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\staging\*"
) else (
cd "%SCRIPTDIR%\staging"
"%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\staging\new-install\"
"%SVZIP%" a "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\staging\! SRB2 INSTALL INSTRUCTIONS !.txt"
cd "%SCRIPTDIR%"
) )
copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Patch.exe" copy /y /b "%SCRIPTDIR%\sfx\7zsd_LZMA2_x64.sfx" + "%SCRIPTDIR%\sfx\config-patch.txt" + "%SCRIPTDIR%\Patch_x64.7z" "%SCRIPTDIR%\SRB2-%SRB2VERSIONNAME%-x64-Patch.exe"
) )
del /f /q "%SCRIPTDIR%\staging\new-install\staging.txt" del /f /q "%SCRIPTDIR%\staging\new-install\staging.txt"
del /f /q "%SCRIPTDIR%\staging\new-install\uninstall.exe"

View file

@ -17,7 +17,7 @@ Shortcut="Pu,{%%T\\srb2win.exe},{-opengl},{Sonic Robo Blast 2},{Sonic Robo Blast
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}" Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}" Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}"
Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}" Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}"
Shortcut="Pu,{cmd.exe},{/c \"%%T\\uninstall.bat\"},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}" Shortcut="Pu,{%%T\\uninstall.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}"
RunProgram="nowait:\"%%T\\new-install\\staging.bat\"" RunProgram="nowait:\"%%T\\new-install\\staging.bat\""

View file

@ -17,7 +17,7 @@ Shortcut="Pu,{%%T\\srb2win.exe},{-opengl},{Sonic Robo Blast 2},{Sonic Robo Blast
Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}" Shortcut="Pu,{%%T\\srb2win.exe},{-opengl -win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (OpenGL, Windowed)},{%%T\\},{%%T\\srb2win.exe},{0}"
Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}" Shortcut="Pu,{%%T\\srb2dd.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw)},{%%T\\},{%%T\\srb2dd.exe},{0}"
Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}" Shortcut="Pu,{%%T\\srb2dd.exe},{-win},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{SRB2 (DirectDraw, Windowed)},{%%T\\},{%%T\\srb2dd.exe},{0}"
Shortcut="Pu,{cmd.exe},{/c \"%%T\\uninstall.bat\"},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}" Shortcut="Pu,{%%T\\uninstall.exe},{},{Sonic Robo Blast 2},{Sonic Robo Blast 2 (SRB2), a 3D Sonic the Hedgehog fangame.},{Uninstall SRB2},{%%T\\},{shell32.dll},{31}"
RunProgram="nowait:\"%%T\\new-install\\staging.bat\"" RunProgram="nowait:\"%%T\\new-install\\staging.bat\""

View file

@ -0,0 +1,13 @@
;!@Install@!UTF-8!
GUIFlags="1+2+8"
GUIMode="2"
Title="Uninstall SRB2"
BeginPrompt="Are you sure you want to uninstall Sonic Robo Blast 2?\n\nYour game data and mods will be preserved, as well as\nany extra files in your install folder."
InstallPath="%%S"
RunProgram="nowait:\"%%S\\uninstall.bat\" /y"
;!@InstallEnd@!

View file

@ -26,12 +26,28 @@ set "STAGINGDIR=!STAGINGDIR:~0,-1!"
for %%d in ("!STAGINGDIR!") do set "INSTALLDIR=%%~dpd" for %%d in ("!STAGINGDIR!") do set "INSTALLDIR=%%~dpd"
set "INSTALLDIR=!INSTALLDIR:~0,-1!" set "INSTALLDIR=!INSTALLDIR:~0,-1!"
:: Find 7z
set SVZIP=
if ["%SVZIP%"] == [""] (
if exist "!ProgramFiles(x86)!\7-Zip\7z.exe" set "SVZIP=!ProgramFiles(x86)!\7-Zip\7z.exe"
if exist "!ProgramFiles!\7-Zip\7z.exe" set "SVZIP=!ProgramFiles!\7-Zip\7z.exe"
if exist "!ProgramW6432!\7-Zip\7z.exe" set "SVZIP=!ProgramW6432!\7-Zip\7z.exe"
)
:: Is it in PATH?
if ["%SVZIP%"] == [""] (
"7z.exe" --help > NUL 2> NUL
if NOT errorlevel 1 (
set "SVZIP=7z.exe"
)
)
:: FAILSAFE: Check if staging.txt exists in the directory :: FAILSAFE: Check if staging.txt exists in the directory
:: If not, exit, so we don't mess up anything by accident. :: If not, exit, so we don't mess up anything by accident.
if exist "!STAGINGDIR!\staging.txt" ( if NOT exist "!STAGINGDIR!\staging.txt" (
echo.
) else (
exit exit
) )
@ -93,25 +109,19 @@ if errorlevel 1 (
: Are we in Program Files? : Are we in Program Files?
echo.!STAGINGDIR! | findstr /C:"!ProgramFiles!" 1>nul echo.!STAGINGDIR! | findstr /C:"!ProgramFiles!" 1>nul
if errorlevel 1 ( if NOT errorlevel 1 (
echo.
) else (
goto SetUserDir goto SetUserDir
) )
:: Are we in Program Files (x86)? :: Are we in Program Files (x86)?
echo.!STAGINGDIR! | findstr /C:"!ProgramFiles(X86)!" 1>nul echo.!STAGINGDIR! | findstr /C:"!ProgramFiles(X86)!" 1>nul
if errorlevel 1 ( if NOT errorlevel 1 (
echo.
) else (
goto SetUserDir goto SetUserDir
) )
:: Are we 32-bit and actually in Program Files? :: Are we 32-bit and actually in Program Files?
echo.!STAGINGDIR! | findstr /C:"!ProgramW6432!" 1>nul echo.!STAGINGDIR! | findstr /C:"!ProgramW6432!" 1>nul
if errorlevel 1 ( if NOT errorlevel 1 (
echo.
) else (
goto SetUserDir goto SetUserDir
) )
@ -207,6 +217,16 @@ mkdir "!OLDINSTALLDIR!"
:: install root, then copy that also to old-install :: install root, then copy that also to old-install
:: ::
:: Extract the uninstall-list.txt and uninstall-userdir.txt files from uninstaller.exe
:: if it exists
if exist "!INSTALLDIR!\uninstall.exe" (
if NOT ["!SVZIP!"] == [""] (
"!SVZIP!" x "!INSTALLDIR!\uninstall.exe" "uninstall-list.txt" -o"!INSTALLDIR!"
"!SVZIP!" x "!INSTALLDIR!\uninstall.exe" "uninstall-userdir.txt" -o"!INSTALLDIR!"
)
)
set OLDINSTALLCHANGED= set OLDINSTALLCHANGED=
if exist "!STAGINGDIR!\old-install-list.txt" ( if exist "!STAGINGDIR!\old-install-list.txt" (
@ -223,12 +243,8 @@ set "TESTFILE=!TEMP!\!RANDOM!.txt"
:: See uninstall.bat for details :: See uninstall.bat for details
for /F "usebackq tokens=*" %%A in ("!STAGINGDIR!\old-install-list.txt") do ( for /F "usebackq tokens=*" %%A in ("!STAGINGDIR!\old-install-list.txt") do (
if exist "!INSTALLDIR!\%%A" ( if exist "!INSTALLDIR!\%%A" (
if ["%%A"] == [""] ( if NOT ["%%A"] == [""] (
echo. if NOT ["%%A"] == ["%~nx0"] (
) else (
if ["%%A"] == ["%~nx0"] (
echo.
) else (
echo %%A> "!TESTFILE!" echo %%A> "!TESTFILE!"
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
@ -267,12 +283,23 @@ dir /b /a-d "!STAGINGDIR!" >> "!INSTALLDIR!\uninstall-list.txt"
echo !USERDIR! > "!INSTALLDIR!\uninstall-userdir.txt" echo !USERDIR! > "!INSTALLDIR!\uninstall-userdir.txt"
:: Add the install-generated to the uninstall list :: Add the install-generated to the uninstall list
:: NO FOLLOWING SPACES AFTER THE FILENAME!!!
echo uninstall-list.txt >> "!INSTALLDIR!\uninstall-list.txt" echo uninstall.bat>> "!INSTALLDIR!\uninstall-list.txt"
echo uninstall-userdir.txt >> "!INSTALLDIR!\uninstall-list.txt" echo uninstall-list.txt>> "!INSTALLDIR!\uninstall-list.txt"
echo uninstall-userdir.txt>> "!INSTALLDIR!\uninstall-list.txt"
:: *ahem* Prints as ^! SRB2 Data Folder ^!.lnk :: *ahem* Prints as ^! SRB2 Data Folder ^!.lnk
:: We need to escape the exclamations (^^!) and the carets themselves (^^^^) :: We need to escape the exclamations (^^!) and the carets themselves (^^^^)
echo ^^^^^^! SRB2 Data Folder ^^^^^^!.lnk >> "!INSTALLDIR!\uninstall-list.txt" echo ^^^^^^! SRB2 Data Folder ^^^^^^!.lnk>> "!INSTALLDIR!\uninstall-list.txt"
:: Add the uninstall list files to the uninstall EXE
if NOT ["!SVZIP!"] == [""] (
if exist "!INSTALLDIR!\new-install\uninstall.exe" (
"!SVZIP!" a "!INSTALLDIR!\new-install\uninstall.exe" "!INSTALLDIR!\uninstall-list.txt" -sdel
"!SVZIP!" a "!INSTALLDIR!\new-install\uninstall.exe" "!INSTALLDIR!\uninstall-userdir.txt" -sdel
)
)
:: Start moving files :: Start moving files
@ -281,12 +308,8 @@ for %%F in ("!STAGINGDIR!\*") DO (
set OLDINSTALLCHANGED=1 set OLDINSTALLCHANGED=1
move "!INSTALLDIR!\%%~nxF" "!OLDINSTALLDIR!\%%~nxF" move "!INSTALLDIR!\%%~nxF" "!OLDINSTALLDIR!\%%~nxF"
) )
if ["%%~nxF"] == ["staging.bat"] ( if NOT ["%%~nxF"] == ["staging.bat"] (
echo. if NOT ["%%~nxF"] == ["staging.txt"] (
) else (
if ["%%~nxF"] == ["staging.txt"] (
echo.
) else (
move "!STAGINGDIR!\%%~nxF" "!INSTALLDIR!\%%~nxF" move "!STAGINGDIR!\%%~nxF" "!INSTALLDIR!\%%~nxF"
) )
) )

View file

@ -11,28 +11,30 @@ set "USERDIR=!USERDIR:~0,-1!"
: ProceedPrompt : ProceedPrompt
set PROCEED= if ["%1"] == ["/y"] (
set /p PROCEED="Are you sure you want to uninstall SRB2? [yes/no] " set "PROCEED=1"
if /I ["!PROCEED:~0,1!"] == ["n"] exit
if /I ["!PROCEED!"] == ["y"] (
echo Type Yes or No
echo.
goto ProceedPrompt
) else ( ) else (
if /I ["!PROCEED!"] == ["yes"] ( set PROCEED=
set PROCEED=1 set /p PROCEED="Are you sure you want to uninstall SRB2? [yes/no] "
) else (
if /I ["!PROCEED:~0,1!"] == ["n"] exit
if /I ["!PROCEED!"] == ["y"] (
echo Type Yes or No
echo. echo.
goto ProceedPrompt goto ProceedPrompt
) else (
if /I ["!PROCEED!"] == ["yes"] (
set PROCEED=1
) else (
echo.
goto ProceedPrompt
)
) )
) )
:: Failsafe, in case we Ctrl+C and decline "Terminate batch file?" :: Failsafe, in case we Ctrl+C and decline "Terminate batch file?"
if ["!PROCEED!"] == ["1"] ( if NOT ["!PROCEED!"] == ["1"] (
echo.
) else (
exit exit
) )
@ -69,17 +71,14 @@ if errorlevel 1 (
:: Can %%A be substring'd to get only the filename and extension? :: Can %%A be substring'd to get only the filename and extension?
:: If so, print that to the temp file instead of the whole line :: If so, print that to the temp file instead of the whole line
:: And possibly do the folder check before the invalid char check. :: And possibly do the folder check before the invalid char check.
:: ALSO: Don't honor upward relative paths! (..\)
:: ::
set "TESTFILE=!TEMP!\!RANDOM!.txt" set "TESTFILE=!TEMP!\!RANDOM!.txt"
for /F "usebackq tokens=*" %%A in ("!INSTALLDIR!\uninstall-list.txt") do ( for /F "usebackq tokens=*" %%A in ("!INSTALLDIR!\uninstall-list.txt") do (
if exist "!INSTALLDIR!\%%A" ( if exist "!INSTALLDIR!\%%A" (
if ["%%A"] == [""] ( if NOT ["%%A"] == [""] (
echo. if NOT ["%%A"] == ["%~nx0"] (
) else (
if ["%%A"] == ["%~nx0"] (
echo.
) else (
echo %%A> "!TESTFILE!" echo %%A> "!TESTFILE!"
findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul findstr /r ".*[<>:\"\"/\\|?*%%].*" "!TESTFILE!" >nul
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
@ -113,9 +112,7 @@ rmdir /s /q "!AppData!\Microsoft\Windows\Start Menu\Programs\Sonic Robo Blast 2"
set USERDIRFILLED= set USERDIRFILLED=
set INSTALLDIRFILLED= set INSTALLDIRFILLED=
for /F %%i in ('dir /b /a "!USERDIR!\*"') do ( for /F %%i in ('dir /b /a "!USERDIR!\*"') do (
if ["%%i"] == ["%~nx0"] ( if NOT ["%%i"] == ["%~nx0"] (
echo.
) else (
set USERDIRFILLED=1 set USERDIRFILLED=1
goto InstallFilledCheck goto InstallFilledCheck
) )
@ -123,9 +120,7 @@ for /F %%i in ('dir /b /a "!USERDIR!\*"') do (
: InstallFilledCheck : InstallFilledCheck
if /I ["!USERDIR!"] == ["!INSTALLDIR!"] ( if /I NOT ["!USERDIR!"] == ["!INSTALLDIR!"] (
echo.
) else (
for /F %%i in ('dir /b /a "!INSTALLDIR!\*"') do ( for /F %%i in ('dir /b /a "!INSTALLDIR!\*"') do (
if ["%%i"] == ["%~nx0"] ( if ["%%i"] == ["%~nx0"] (
echo. echo.
@ -161,9 +156,7 @@ if ["!INSTALLDIRFILLED!"] == ["1"] (
set FINALRESPONSE= set FINALRESPONSE=
set /p FINALRESPONSE="!FINALPROMPT! " set /p FINALRESPONSE="!FINALPROMPT! "
if ["!FINALPROMPT!"] == ["Press Enter key to exit."] ( if NOT ["!FINALPROMPT!"] == ["Press Enter key to exit."] (
echo.
) else (
if /I ["!FINALRESPONSE:~0,1!"] == ["y"] ( if /I ["!FINALRESPONSE:~0,1!"] == ["y"] (
if ["!USERDIRFILLED!"] == ["1"] ( if ["!USERDIRFILLED!"] == ["1"] (
"!SystemRoot!\explorer.exe" "!USERDIR!" "!SystemRoot!\explorer.exe" "!USERDIR!"