I have a test.bat file where i need to write a script to check PATH VARIABLE for java already installed or not ?
 Conditions :-
  1) If yes then 
       a) Check for the java version .
       b) Check for JAVA_HOME env variable :-
           i) if no , create it.
           ii) if yes , get the JAVA_HOME value.
  2) If No then
   set JAVA_HOME to local path (embedded)
 I know the commands like :-
      For version
         -> java -version
      For variable path 
         -> echo %path%
      For Java variable path
         -> echo %JAVA_HOME%
But how to write script for these condition in batch file i.e .bat ? I'm very new to this so kindly give me your valuable answers or helpful links.
 
     
     
     
     
    