For below batch file, When both or any one folder NOT exist then ONLY :notfound
label execute which is correct, but when both folder exist, then both :bothfound
and :notfound
labels execute.
How we can run ONLY execute :bothfound
when both folder Temp1 and Temp2 exist?
@ECHO OFF
set "folder1=C:Temp1"
set "folder2=C:Temp2"
IF EXIST %folder1% IF EXIST %folder2% goto bothfound
goto notfound
:bothfound
echo Both folders exist.
:notfound
echo either one or both folder not exist.
echo Done.
pause
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…