@echo off
echo 当前环境变量: %JAVA_HOME%
set JDK8=false
echo %JAVA_HOME%|find "jdk1.8">nul&&set JDK8=true
if "%JDK8%"=="true" (
echo 切换到java11环境
setx /m JAVA_HOME "C:Program FilesJavajdk-11.0.11"
) else (
echo 切换到java8环境
setx /m JAVA_HOME "C:Program FilesJavajdk1.8.0_144"
)
pause