Hi
I want to list of used variables ,but without command SET cause i don´t want to display name of variables just arguments.
etc. I have variables v1 to v18. I want to display arguments of variables from v14 to v18.(just arguments)
for /l %%G in (14,1,18) do (
echo %v%%G%
)
I don´t know correct syntax in echo line....if I want to use variable in variable....
THX for info.....
How to list of used variables ?
Moderator: DosItHelp
-
- Posts: 9
- Joined: 23 Jan 2012 14:45
How to list of used variables ?
Last edited by H5N1 Bird Flu on 08 Feb 2012 14:01, edited 1 time in total.
-
- Posts: 9
- Joined: 23 Jan 2012 14:45
Re: How to list of used variables ?
OK....I solved my self....
Correct form:
for /l %%G in (14,1,18) do (
echo !v%%G!
)
Correct form:
for /l %%G in (14,1,18) do (
echo !v%%G!
)
Last edited by H5N1 Bird Flu on 08 Feb 2012 14:01, edited 1 time in total.
Re: How to list of used variables ?
Code: Select all
for /f "tokens=1,2 delims==" %%G in ('set v') do echo %%H
This would give you all the contents of the variables that start with v.
Now if you just wanted 14 through 18 you could set a counter variable and use that in the For Loop. After the For Loop you could check the counter variable to see if it is less than 18 and then GOTO a label before the FOR command. Not as efficient as using delayed expansion and a FOR /L loop but I just wanted to prove that yes you could use a SET command to do it.
You could also hard code all the variables if you really wanted.
Code: Select all
for %G in (%v14% %v15% %v16% %v17% %v18%) do echo %G
-
- Posts: 9
- Joined: 23 Jan 2012 14:45
Re: How to list of used variables ?
OK..thx for reply
....the first solution shows that it is possible also with SET command
...but I can´t use hard code of variables cause I don´t know how many variables will be there finally. It´s up to user when he sets ini file ,from which batch file is loading variables....

....the first solution shows that it is possible also with SET command

...but I can´t use hard code of variables cause I don´t know how many variables will be there finally. It´s up to user when he sets ini file ,from which batch file is loading variables....