L
lunart666
I have a situation where I want to be able to echo a variable to a flag
file to run a for loop over the values. What I want to do is to be able
to SET the variable at the top of the script and allow people to add
more variables then loop the new ones through.
Example
SET FLAGNUMBER=2
SET FLAG1=8
SET FLAG2=26
::Create flag file
SET COUNT=0
::MakeFlagFile
SET /A COUNT=%COUNT%+1
echo %FLAG%%COUNT% >> FLAGFILE.txt (this is the line that has me beat)
if %COUNT%==%FLAGNUMBER% CALL :FORLOOP
GOTO MakeFlagFile
:FORLOOP
Now naturally this isn't going to work, as FLAG hasn't been set, but
what I want to do is somehow echo out FLAG1, and FLAG2 using the
incrementation of the SET command.
The way iI want it to work is that peeps just need to increment the
FLAGNUMBER by one and add SET FLAG3=whatever and the for loop processes
each of those values.
Any ideas?
Thanks.
file to run a for loop over the values. What I want to do is to be able
to SET the variable at the top of the script and allow people to add
more variables then loop the new ones through.
Example
SET FLAGNUMBER=2
SET FLAG1=8
SET FLAG2=26
::Create flag file
SET COUNT=0
::MakeFlagFile
SET /A COUNT=%COUNT%+1
echo %FLAG%%COUNT% >> FLAGFILE.txt (this is the line that has me beat)
if %COUNT%==%FLAGNUMBER% CALL :FORLOOP
GOTO MakeFlagFile
:FORLOOP
Now naturally this isn't going to work, as FLAG hasn't been set, but
what I want to do is somehow echo out FLAG1, and FLAG2 using the
incrementation of the SET command.
The way iI want it to work is that peeps just need to increment the
FLAGNUMBER by one and add SET FLAG3=whatever and the for loop processes
each of those values.
Any ideas?
Thanks.