problem with variables

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Mohammad_Dos
Posts: 84
Joined: 08 Sep 2010 10:25
Location: Iran,Kashan
Contact:

problem with variables

#1 Post by Mohammad_Dos » 04 Apr 2012 09:51

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: )

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: problem with variables

#2 Post by foxidrive » 04 Apr 2012 10:12

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

Post Reply