JDK automatic setup script under Windows - JAVA

If CMD window following script code garbled, then the post-processing according to the following, it can be:

https://www.cnblogs.com/sunylat/p/11308037.html

OFF @echo
 echo ********************************************** **************  
 echo * *  
 echo * the JDK system environment variable settings, run as administrator *  
 echo * *  
 echo ************** **********************************************  
 echo .     
: the START 
the SET / the p-javahome = Please enter the JDK installation path: 
IF EXIST " % javahome% \ bin \ java.exe " GOTO the iNSTALL 
: the WARNING 
REM input directory errors prompted to re-enter the 
echo you entered JDK installation path is not a path
 echo  Please re-enter correct JDK installation path
PAUSE
the START GOTO 
: the INSTALL 
REM JavaSDK as input the correct installation directory, set the environment variable start 
echo path is entered: The javahome%% 
REM LPY   
echo .  
 echo === prepare set the environment variable: The javahome the JAVA_HOME =%%  
 echo === Note: If JAVA_HOME exists, it will be overwritten, this operation is not reversible, check to make sure === !!  
 echo .  
 echo === ready to set environment variables (there later.): CLASSPATH =; %% JAVA_HOME %% \ lib. \ dt.jar; %% %% JAVA_HOME \ lib \ tools.jar;  
 echo === Note: If CLASSPATH exists, it will be overwritten, this operation is not reversible, double-check to confirm === !!  
 echo .  
 echo == = ready to set the environment variable: PATH = %% %% JAVA_HOME \ bin; %% %% JAVA_HOME \ jre \ bin;  
 echo === Note: PATH will be added at the top,  
 echo  .  
the sET / P after EN = Please confirm press the Enter key to start setting!  
 echo .  
 echo .  
 echo .  
 echo .  
 echo === newly created environment variables javahome% =% JAVA_HOME   
setX " JAVA_HOME "  " % javahome% " - M  
 echo .  
 echo .  
 echo === create a new environment variable = the CLASSPATH;. %% %% JAVA_HOME \ lib \ dt.jar; %% %% JAVA_HOME \ lib \ tools.jar;   
setX " the CLASSPATH "  " ;. %% %% JAVA_HOME \ lib \ dt.jar; %% %% JAVA_HOME \ lib \ tools.jar; " - M  
 echo .  
 echo.  
 Echo === new environment variable added (appended to the front) the PATH = %% %% the JAVA_HOME \ bin; %% %% the JAVA_HOME \ JRE \ bin;    

WMIC ENVIRONMENT WHERE " name = 'path' and username = '<System > ' " the SET VariableValue = " %% %% JAVA_HOME \ bin; %% %% JAVA_HOME \ jre \ bin;% path% " 
setX path " % path% " 
echo .  
 echo .   
REM LPY HTTP: // blog.csdn. NET / sadwxds / Article This article was / the Details / 52,984,272 
echo === press any key to exit!    
PAUSE > NUL  

 

Guess you like

Origin www.cnblogs.com/sunylat/p/11308064.html