Batch Processing Command: one-click JDK installation/one-click JRE installation and automatic configuration of Java environment variables, jdkjre
Installing JDK/installing JRE and configuring java environment variables is a headache for java beginners. Here we will share a simple batch processing command, to help you complete JDK or install JRK separately.
Key steps:
1. Create a New. txt file and copy Attachment 1/. 2 to the file;
2. modify the content in the document:
Appendix 1: start/WAIT jdk-8u141-windows-i586.exe/qn INSTALLDIR = C: \ Java \ jdk1.8
Appendix 2: start/WAIT jre-8u144-windows-i586.exe/s INSTALLDIR = C: \ Java \ jre
Add the red part to the JDK name/JRE name you downloaded,Note: Put documents and software in a folder.
3.change the suffix of the .txt file to the suffix of the. bat file;
4. Double-click to run the task. The installation and configuration are complete.
Please remember to give me a thumbs up. If you have any questions, please leave a message!
Attachment 1 (one-click JDK installation and configuration environment ):
@ Echo off % 1 mshta vbscript: CreateObject ("Shell. Application"). ShellExecute ("cmd.exe", "/c % ~ S0: "," "," runas ", 1) (window. close) & exitset myjdkpath = C: \ Java \ jdk1.8echo ************************************ * ********* echo. echo will install jdkecho. press any key to exit and close the echo window. echo *************************************** * ****** pauseecho. echo is installing jdk. Please do not perform other operations echo. wait for three or four minutes. start/WAIT jdk-8u141-windows-i586.exe/qn INSTALLDIR = C: \ Java \ jdk1.8echo jdk installation completed set JAVA_HOME = C: \ Java \ jdk1.8set PATH = % P ATH %; % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ binset CLASSPATH = .; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jarset RegV = HKLM \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environmentreg add "% RegV %"/v "JAVA_HOME"/d "% JAVA_HOME %"/freg add "% RegV % "/v" Path "/t REG_EXPAND_SZ/d" % PATH % "/freg add" % RegV % "/v" CLASSPATH "/d" % CLASSPATH % "/fmshta vbscript: msgbox ("the Java environment has been successfully registered! ", 64," successful ") (window. close) #-Dfile. encoding = utf-8exit
Appendix 2 (one-click JRE installation and configuration environment ):
@ Echo off % 1 mshta vbscript: CreateObject ("Shell. Application"). ShellExecute ("cmd.exe", "/c % ~ S0: "," "," runas ", 1) (window. close) & exitset myjrepath = C: \ Java \ jreecho ************************************ * ********* echo. echo: The software running environment jreecho will be installed. press any key to exit and close the echo window. echo *************************************** * ****** pauseecho. echo is installing jre. Please do not perform other operations echo. please wait for four or five minutes. start/WAIT jre-8u144-windows-i586.exe/s INSTALLDIR = C: \ Java \ jreecho jre installation completed set JAVA_HOME = C: \ Javaset PATH = % PATH %; % J AVA_HOME % \ jre \ binset CLASSPATH = .; % JAVA_HOME % \ jre \ libset RegV = HKLM \ SYSTEM \ CurrentControlSet \ Control \ Session Manager \ Environmentreg add "% RegV %"/v "JAVA_HOME"/d "% JAVA_HOME % "/freg add" % RegV % "/v" Path "/t REG_EXPAND_SZ/d" % PATH % "/freg add" % RegV % "/v" CLASSPATH "/d" % CLASSPATH % "/fmshta vbscript: msgbox ("the Java environment has been successfully registered! ", 64," successful ") (window. close) exit