Can you do nested if statements with Windows batch files?

dude8604

Platinum Member
Oct 3, 2001
2,680
0
0
I'm not sure if I can't do it because I'm writing the code wrong or because it's not possible.
 

igowerf

Diamond Member
Jun 27, 2000
7,697
1
76
Yeah. They can be nested. I just did a quick test in a folder that I'm working in:

@echo off

if exist index.asp (
if exist test.bat echo hi
if exist nonExistantFile echo hello
)