I am trying a simple operation in a batch file. Iterate through tokens and perform some task for each token.
Can someone point out why following script results in a recursive loop and iterating through the first token all the time ?
@echo off
set servers=10.20.30.40,200.300.400.500
echo %servers%
Call :configureDataStore "%servers%"
goto :eos
:configureDataStore
set list=%servers%
set list=%list:"=%
FOR /f "tokens=1* delims=," %%a IN ("%list%") DO (
if not "%%a" == "" call :configureSlave %%a
if not "%%b" == "" (
set servers = %%b
call :configureDataStore "%%b"
)
)
goto :eos
:configureSlave
echo In subroutine %1
goto :eos
:eos