02Variables.bat
::this program will demonstrate variables in batch file @echo off ::set is used to declare and initialize variables ::by default variables are declared in global scope set var1=I am global variable ::to print the value of variable surrount by %% echo "var1 value:: %var1%" ::to declare variable in local scope SETLOCAL set var_2=I am the local variable, my life limited to SETLOCAL block echo %var_2 value:: var_2% ENDLOCAL ::ENDLOCAL is used to terminate the local block and scope, var_2 variable will be destroyed & dead after this. echo "var_2 value after ENDLOCAL:: %var_2%" ::/A param used to assign numeric value set /A data_num=100 echo "data_num value:: %data_num%"
Output
