08IfElse.bat
::This program is used to demonstrate the if else decision making structures @echo off set /A var_1=10 set /A var_2=20 ::apply if else to check if two variables are same or different if %var_1%==%var_2% (echo var_1 and var_2 are equal) else (echo var1 and var2 are not equal ) ::apply if to check if variable is already defined if DEFINED var_1 (echo var_1 is defined) if NOT DEFINED var_2 (echo var_2 is undefined, hence defining again && set /A var2=21) else (echo var_2 is defined) ::apply if to check if file specified exists or not if exist 05Data.txt (echo 05Data.txt file exists) else (echo 05Data.txt file does not exist) pause
Output
