I am using Microsoft Windows XP [Version 5.1.2600]
Trying to do this.
Trying to create the variable dynamically and then read the value out of that variable in a loop.
@ECHO off
SET SQL1=TEST
SET SQL2=TEST1
SET SQL3=TEST2
SET SQL=SQL
SETLOCAL ENABLEDELAYEDEXPANSION
SET /A number=0
FOR /l %%A IN (1,1,3) DO (
SET /A number = number + 1
echo !number!
echo %SQL%!number!
)
endlocal
Output should be
1
test
2
test2
3
test3
I am getting
C:\temp>c.bat
1
SQL1
2
SQL2
3
SQL3
Please help!
Ugh.
First way (note that instead of your
numbervariable, it uses the loop counter variable%%A):Second way (ugly but it does what you want):