@echo off CD /D "%~dp0" :checkUserPermissions echo Checking if the Greenstone directory is writable ... (echo This is a temporary file. It is safe to delete it. > "testing.tmp" ) 2>nul if exist "testing.tmp" goto deleteTempFile if "%1" == "Elevated" goto printWarning echo ... FAILED echo The uninstaller cannot write to the Greenstone directory (%CD%) echo Requesting elevated status to become admin user to continue. ..\bin\windows\gstart.exe %0 Elevated %1 %2 %3 %4 %5 %6 %7 %8 %9 goto done :printWarning echo ... FAILED echo The uninstaller cannot write to the Greenstone directory (%CD%). echo Attempting to continue without permissions. goto shiftElevated :deleteTempFile echo ... OK del "testing.tmp" :shiftElevated :: Shift "Elevated" (one of our own internal command words) out of the way if present :: so the command-line is as it was when the user initiated the command if "%1" == "Elevated" shift if exist ..\bin\windows\search4j.exe ..\bin\windows\search4j.exe -p ..\packages\jre -l .\uninst.jar if exist ..\gs2build\bin\windows\search4j.exe ..\gs2build\bin\windows\search4j.exe -p ..\packages\jre -l .\uninst.jar if exist uninst.flag ( rd /s /q ..\packages\jre rmdir ..\packages if exist ..\bin\windows\search4j.exe ( del ..\bin\windows\search4j.exe rmdir ..\bin\windows ) if exist ..\gs2build\bin\windows\search4j.exe ( del ..\gs2build\bin\windows\search4j.exe rd /s /q ..\gs2build ) del uninst.jar del uninst.flag del Uninstall.* del *.uninstall del ..\bin del ..\tmp del ..\ext cd .. if NOT EXIST *.* ( set GSDEL=%CD% cd .. rmdir %GSDEL% ) ) :done