我将如何在其中添加和 Else 选项来表示:
您没有 java 开发工具包,请选择选项 4?
FOR /R "C:\Program Files" %%a IN (.) DO (
IF EXIST "%%~a\javac.exe" ECHO You Have The Java Dev Kit Ignore Option 4
)
我将如何在其中添加和 Else 选项来表示:
您没有 java 开发工具包,请选择选项 4?
FOR /R "C:\Program Files" %%a IN (.) DO (
IF EXIST "%%~a\javac.exe" ECHO You Have The Java Dev Kit Ignore Option 4
)
您需要搜索所有子目录以确定它是否存在。
set found=0
FOR /R "C:\Program Files" %%a IN (.) DO (
IF EXIST "%%~a\javac.exe" set found=1
)
if %found%==0 (
ECHO You don't have the java dev kit please select option 4
) ELSE (
echo Found javac.exe
)
SET found=0
FOR /R "C:\Program Files" %%a IN (.) DO (
IF EXIST "%%~a\javac.exe" ( ECHO You Have The Java Dev Kit Ignore Option 4
SET found=1)
)
IF %found%==0 ( ECHO You don't have the java dev kit please select option 4 )
如果你想要 ELSE,你必须使用(
和)
括号。