Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM The following (until :next) checks the OS architecture the latest version of Java Runtime
- REM is not installed and acts accordingly.
- :Java
- echo %PROCESSOR_ARCHITECTURE% | find "x" >NUL
- if ERRORLEVEL 1 goto :JAVAx86_64CHECKS
- REM Check installed programs and pass to :All-Installations-Java
- for /f %%I in ('reg query HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java %%I
- REM If control is passed back here it is ok to install the latest JRE
- goto :JavaInstall
- :All-Installations-Java
- Rem Receive and installation and check for Oracle, Java installs Pass the key to :Oracle Installations
- for /f "tokens=2*" %%T in ('reg query %1 /v Publisher 2^> nul') do echo %%U | find "Oracle" > nul && for /f "tokens=2*" %%T in ('reg query %1 /v DisplayName 2^> nul') do echo %%U | find /i "java(TM) 6" > nul && call :Oracle-Installations %1
- goto :EOF
- :Oracle-Installations
- Rem Check the version of Java and either move onto :Next or pass back to the calling function to install Java
- for /f "tokens=2*" %%T in ('reg query %1 /v DisplayVersion 2^> nul') do echo %%U | find "6.0.310" >NUL && goto :Next
- goto :EOF
- :JavaInstall
- REM installing latest version x86 JRE
- msiexec /i \\path\to\jre1.6.0_31.msi /qn /norestart
- goto :Next
- :JAVAx86_64CHECKS
- REM Check the list of 32-bit programs installed and pass each key to :All-Installations-Java-x86
- for /f %%I in ('reg query HKLM\SOFTWARE\Wow6432Node\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java-x86 %%I
- REM If Control is passed back here it is ok to install 32-bit JRE
- call :JavaInstallx86
- :JAVAx64CHECK
- REM Check the list of 32-bit programs installed and pass each key to :All-Installations-Java-x86
- for /f %%I in ('reg query HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java %%I
- REM If Control is passed back here it is ok to install 64-bit JRE
- call :JavaInstallx64
- goto :Next
- :All-Installations-Java-x86
- Rem Receive an installed program key and check for Oracle, Java installs Pass the key to :Oracle Installations-x86
- for /f "tokens=2*" %%T in ('reg query %1 /v Publisher 2^> nul') do echo %%U | find "Oracle" > nul && for /f "tokens=2*" %%T in ('reg query %1 /v DisplayName 2^> nul') do echo %%U | find /i "java(TM) 6" > nul && call :Oracle-Installations-x86 %1
- goto :EOF
- :Oracle-Installations-x86
- Rem Check the version of Java and either move onto :JAVAx64Check or pass back to the calling function to install Java
- for /f "tokens=2*" %%T in ('reg query %1 /v DisplayVersion 2^> nul') do echo %%U | find "6.0.310" >NUL && goto :JAVAx64CHECK
- goto :EOF
- :JavaInstallx86
- REM echo installing latest x86 version of JRE
- msiexec /i \\Path\To\Installer\jre1.6.0_24\jre1.6.0_31.msi /qn /norestart
- goto :EOF
- :JavaInstallx64
- REM echo installing latest x64 JRE version
- msiexec /i \\Pathto\installer\jre1.6.0_24x64\jre1.6.0_31x64.msi /qn /norestart
- goto :EOF
- :Next
Advertisement
Add Comment
Please, Sign In to add comment