我想检查环境中是否存在JAVA_HOME
所以我写了下面的脚本a.bat @H_404_2@if "%JAVA_HOME%" == "" ( echo Enter path to JAVA_HOME: set /p javahome= ) if not "%JAVA_HOME%" == "" ( echo %JAVA_HOME% )
所以我写了下面的脚本a.bat @H_404_2@if "%JAVA_HOME%" == "" ( echo Enter path to JAVA_HOME: set /p javahome= ) if not "%JAVA_HOME%" == "" ( echo %JAVA_HOME% )
它显示“命令的语法不正确”我哪里出错了?
尝试这个:
@H_404_2@@echo off
IF "%JAVA_HOME%" == "" (
echo Enter path to JAVA_HOME:
set /p JAVA_HOME=
) ELSE (
echo %JAVA_HOME%
)