So, I have some nested variables in Batch.
It's causing me an issue.
The reason I have nested variables is because I am emulating an array via:
array[0]=1
array[1]=2
array[2]=3
etc
Now, I have a counter counter
I want to be able to do %array[!counter!]%
, and the output would equal !counter! + 1
.
But I can't.
I think it's because having it surrounded in %
's makes Windows try to expand the variable ASAP, and it does, breaking the counter.
So, instead, why not do !array[!counter!]!
? Well, I tried this, and I think that, instead of interpreting it as (array[(counter)])
, where ()
's are used to show what !!
's are holding, Windows instead interprets it as (array[)counter()
, which is useless to me.
Keep in mind: Whenever I use !!
's, assume I have done setlocal EnableDelayedExpansion
-- I just don't include it as that would be a pain for both me and readers.
Any ideas how to fix this?