如果批量存在 [英] If Exist And Else in batch
本文介绍了如果批量存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何在其中添加和其他选项说:
您没有Java开发工具包,请选择选项4?
How would I add and Else option into this to say:
You don't have the java dev kit please select option 4?
FOR /R "C:\Program Files" %%a IN (.) DO (
IF EXIST "%%~a\javac.exe" ECHO You Have The Java Dev Kit Ignore Option 4
)
推荐答案
您需要先搜索所有子目录,以确定其是否存在.
You need to search fist all subdirectories to decide if it's there.
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
)
这篇关于如果批量存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文