The overall objective is that I want to write a batch script which I can pass two arguments- an AD group, and the location of a text file containing a list of users. The finished data will then be passed to an API in another system to import for managing other groups, like mailing lists, etc.
The difficulty is: I want to compare an array value to a numeric variable within a batch script, without using delayed expansion, preferably.
This will allow me to create a "bubble compare" where I can check each new entry against values already in the existing file and then either append the entry to the master list, or do nothing with it if it already exists.
I am trying to do this without using delayed expansion. It has occurred to me that perhaps arrays can not be utilized in this fashion, without delayed expansion. Is it possible to compare incrementing array values without utilizing delayed expansion?
FOR /L %%a IN (0,1,9) DO (
CALL SET numbers[%%a%%]=%%a
)
SET /A i=0
:startLoop
IF "%numbers[%i%]%" EQU "%i%" DO (
ECHO "%i% exists!"
set /A i=%i%+1
GOTO startLoop
)
ELSE ( ECHO "The list has finished at %i%")