Guest User

Untitled

a guest
Mar 16th, 2012
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 3.06 KB | None | 0 0
  1. REM The following (until :next) checks the OS architecture the latest version of Java Runtime
  2. REM is not installed and acts accordingly.
  3. :Java
  4.         echo %PROCESSOR_ARCHITECTURE% | find "x" >NUL
  5.         if ERRORLEVEL 1 goto :JAVAx86_64CHECKS
  6.         REM Check installed programs and pass to :All-Installations-Java
  7.         for /f %%I in ('reg query HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java %%I
  8.         REM If control is passed back here it is ok to install the latest JRE
  9.         goto :JavaInstall
  10.  
  11.     :All-Installations-Java
  12.         Rem Receive and installation and check for Oracle, Java installs Pass the key to :Oracle Installations
  13.         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
  14.         goto :EOF
  15.  
  16.     :Oracle-Installations
  17.         Rem Check the version of Java and either move onto :Next or pass back to the calling function to install Java
  18.         for /f "tokens=2*" %%T in ('reg query %1 /v DisplayVersion 2^> nul') do echo %%U | find "6.0.310" >NUL && goto :Next
  19.         goto :EOF
  20.  
  21.     :JavaInstall
  22.         REM installing latest version x86 JRE
  23.         msiexec /i \\path\to\jre1.6.0_31.msi /qn /norestart
  24.         goto :Next
  25.  
  26.     :JAVAx86_64CHECKS
  27.         REM Check the list of 32-bit programs installed and pass each key to :All-Installations-Java-x86
  28.         for /f %%I in ('reg query HKLM\SOFTWARE\Wow6432Node\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java-x86 %%I
  29.         REM If Control is passed back here it is ok to install 32-bit JRE
  30.         call :JavaInstallx86
  31.     :JAVAx64CHECK
  32.         REM Check the list of 32-bit programs installed and pass each key to :All-Installations-Java-x86
  33.         for /f %%I in ('reg query HKLM\SOFTWARE\microsoft\windows\currentversion\uninstall') do echo %%I | find "{" > nul && call :All-Installations-Java %%I
  34.         REM If Control is passed back here it is ok to install 64-bit JRE
  35.         call :JavaInstallx64
  36.         goto :Next
  37.     :All-Installations-Java-x86
  38.         Rem Receive an installed program key and check for Oracle, Java installs Pass the key to :Oracle Installations-x86
  39.         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
  40.         goto :EOF
  41.  
  42.     :Oracle-Installations-x86
  43.         Rem Check the version of Java and either move onto :JAVAx64Check or pass back to the calling function to install Java
  44.         for /f "tokens=2*" %%T in ('reg query %1 /v DisplayVersion 2^> nul') do echo %%U | find "6.0.310" >NUL && goto :JAVAx64CHECK
  45.         goto :EOF
  46.     :JavaInstallx86
  47.         REM echo installing latest x86 version of JRE
  48.         msiexec /i \\Path\To\Installer\jre1.6.0_24\jre1.6.0_31.msi /qn /norestart
  49.         goto :EOF
  50.  
  51.     :JavaInstallx64
  52.         REM echo installing latest x64 JRE version
  53.         msiexec /i \\Pathto\installer\jre1.6.0_24x64\jre1.6.0_31x64.msi /qn /norestart
  54.         goto :EOF
  55.  
  56.  
  57. :Next
Advertisement
Add Comment
Please, Sign In to add comment