0

I need some help with my current Java Batch File that I deploy through SCCM. I need to now have in the begining of the script before the force closures to see if java version 7u67 is install and if it is exit the script, but if it isnt run the rest of the script. Below is my current script:

***Install.cmd ***


@echo off
cls

:KillIE&JavaProcesses
echo *** This will kill Browsers and Java Processes ***
Rem ***
taskkill /F /IM iexplorer.exe
taskkill /F /IM iexplore.exe
taskkill /F /IM firefox.exe
taskkill /F /IM chrome.exe
taskkill /F /IM jusched.exe
taskkill /F /IM jp2launcher.exe
taskkill /F /IM java.exe
taskkill /F /IM javaw.exe
taskkill /F /IM jqs.exe

:UninstallingOldJREVersions
echo.************************************************************************
echo.************************************************************************
echo.              DO NOT CLOSE THIS WINDOW
echo. All the Java versions from your computer are being removed.
echo.************************************************************************
echo.************************************************************************
wmic product where "name like 'Java(TM) 6%%'" call uninstall 
wmic product where "name like 'Java 7%%'" call uninstall

REM Install JRE x86

msiexec.exe /i "%~dp0jre1.7.0_67.msi" /quiet /norestart AUTOUPDATECHECK=0 JAVAUPDATE=0 JU=0 IEXPLORER=1 MOZILLA=1
:end


REM Return the exit code to SCCM

exit /B %EXIT_CODE%
Josh D'Ambrosio
  • 265
  • 1
  • 3
  • 10
  • possible duplicate of [Get java version from batch file](http://stackoverflow.com/questions/17714681/get-java-version-from-batch-file) – vzamanillo Oct 22 '14 at 16:02
  • Thats really not the same thing. I am not looking for the Java version, I know the Java Version. I am looking to run a check to see if that version is installed. – Josh D'Ambrosio Oct 22 '14 at 18:43

1 Answers1

0

I think you need to issue the command java -version in your batch file. Check with a regular expression or something similar the output of this command. That's how you can decide if your mentioned version of Java is installed.

wtfzn
  • 533
  • 5
  • 13