I have a basic question. Struggling with setting variables within a if () bloc.
Below is my code.
@echo off
setlocal
set var1=variable1
set var1a=%var1%
echo expecting 'variable1' is %var1a%
if 1==1 (
set var2=variable2
set var2a=%var2%
echo expecting 'variable2' %var2a%
)
The output is
expecting 'variable1' is variable1
expecting 'variable2'
How come echo %var2%
does give an output of variable2.
Is there some basic principle I am missing?