title: Batch script for creating an array and store values and co
body: <p>Hi I need a batch script which want to Create an array store a list of values(1.6_445,1.6_555,1.6_745,1.7).Then it needs to Echo the java vesion from the system and the value of the java vesion needs to compare the values with values in the array .If the value is greater than 1.6_445 it needs to display an error message "Not working" 
  (Get the java version of the sytem and if the java vesion value is greater than 1.6_445 it needs to display error)</p>
  
  <p>is it possible ?</p>
  
  <p>Currently I'm using a below script</p>
  
  <p>@echo off 
      setlocal enableextensions disabledelayedexpansion
      :: possible locations under HKLM\SOFTWARE of JavaSoft registry data
      set "javaNativeVersion="
      set "java32ON64=Wow6432Node\"</p>
  
  <pre><code>:: for variables
  ::    %%k = HKLM\SOFTWARE subkeys where to search for JavaSoft key
  ::    %%j = full path of "Java Runtime Environment" key under %%k
  ::    %%v = current java version
  ::    %%e = path to java
  
  set "javaDir="
  set "javaVersion="
  for %%k in ( "%javaNativeVersion%" "%java32ON64%") do if not defined javaDir (
      for %%j in (
          "HKLM\SOFTWARE\%%~kJavaSoft\Java Runtime Environment"
      ) do for /f "tokens=3" %%v in (
          'reg query "%%~j" /v "CurrentVersion" 2^&gt;nul ^| find /i "CurrentVersion"'
      ) do for /f "tokens=2,*" %%d in (
          'reg query "%%~j\%%v" /v "JavaHome"   2^&gt;nul ^| find /i "JavaHome"'
      ) do ( set "javaDir=%%~e" &amp; set "javaVersion=%%v" )
  )
  if not defined javaDir (
  echo Java not found
  </code></pre>
  
  <p>) else (
      echo JAVA_HOME="%javaDir%"
      echo JAVA_VERSION="%javaVersion%"
      if "%javaVersion%" LSS "1.7" (
          echo Java version is compatible!
          goto exit
      ) </p>
  
  <p>But this script is only checking whether the java version is greater than 1.7 but i want to check whether java version is greater than 1.6_445 since it contain an '_' charecter it needs some other method than this.So one possible way will be store the values in an array and compare the current version value(I think) but I dont know how to write the code.</p>