我如何在此添加和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
)
答案 0 :(得分:1)
您需要搜索所有子目录以确定它是否存在。
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
)
答案 1 :(得分:0)
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,则必须使用(
和)
括号。