Page 1 of 1

problem with variables

Posted: 04 Apr 2012 09:51
by Mohammad_Dos
i have a variable named "r". we dont know what nomber is in it.
i set another, named "t"

Code: Select all

set /a t=%r%

i need to set some variables. for example if t=30 i would need 30 new variables. how to set and access them?


i use it:

Code: Select all

set p%t%=eee

but dont know how can i access and change them

it does not work:

Code: Select all

echo %p%t%%


(excuse me for my english :oops: )

Re: problem with variables

Posted: 04 Apr 2012 10:12
by foxidrive

Code: Select all

@echo off
set r=30
set /a t=r
for /L %%a in (1,1,%t%) do set var%%a=abc%%a

for /L %%a in (1,1,%t%) do call echo %%var%%a%%
pause