@echo off
set ESCUR_DIR=%~dp0

copy /b/y NUL %WINDIR%\06CF2EB6-94E6-4a60-91D8-AB945AE8CF39 >NUL 2>&1
if NOT errorlevel 1 goto admin
set message=You must run this program as an administrator 
echo %message%
msg %USERNAME% %message%
goto:eof
:admin
del %WINDIR%\06CF2EB6-94E6-4a60-91D8-AB945AE8CF39 >NUL 2>&1

IF NOT "x%TEMP%" == "x" goto gottemp
echo tempfolder does not exist
exit
:gottemp

set JAVA_HOME=%TEMP%\Bundled_JRE
md %JAVA_HOME%
echo JAVA_HOME=%JAVA_HOME%
set PATH=%JAVA_HOME%\bin;%PATH%
echo copy "%ESCUR_DIR%BundledJRE.exe" to "%JAVA_HOME%\BundledJRE.exe"
copy "%ESCUR_DIR%BundledJRE.exe" "%JAVA_HOME%\BundledJRE.exe"
cd /d "%JAVA_HOME%"
echo Please wait. Installing temporary jre...
"%JAVA_HOME%\BundledJRE.exe"
cd /d "%ESCUR_DIR%"
echo start installer
javaw -splash:..\..\resources\setup.jpg -cp ..\..\lib\BaseInstaller.jar;..\..\lib\WinRegistry.jar com.infor.install.MainProgram -j %1 %2 %3
cd /d "%JAVA_HOME%\.."
IF "x%JAVA_HOME%" == "x" goto reset
echo remove temporary JRE
rmdir /Q /S "%JAVA_HOME%"
:reset
cd /d "%ESCUR_DIR%"
