Nesting IF in Windows Bat file
I'm not actually sure you need ELSE, let alone a nested IF, for your use case:
@echo off
IF NOT "%1%"=="0" (
goto proc3
)
IF "%2%"=="0" (
goto proc1
)
goto proc2
:proc1
echo in Proc1 0 0
pause
exit
:proc2
echo in Proc2 0 N0
pause
exit
:proc3
echo in Proc3 N0 0
pause
exit
If for some reason you really do want to nest your IFs, you're missing a bracket:
Your batch:
IF %1% == 0 ( IF %2% == 0 ( goto proc1 ) ELSE ( goto proc2 ) ***MISSING )*** ELSE ( goto proc3 )
Batch that should work:
IF "%1%" == "0" (
IF "%2%" == "0" (
goto proc1
) ELSE (
goto proc2
)
) ELSE (
goto proc3
)