I have a batch script that reads and prints each line and the line number from a file entry.txt as below.
I have an array called list
.
SETLOCAL enabledelayedexpansion
set i=0
set "strc=autorun_"
set list = PROD01 PROD02 PROD03 BangScan
for /f "tokens=*" %%a in (entry.txt) do (
set /a i+=1
::set /a zrrcount = !i!%5
::echo arrc=%%zrrcount
::echo list[%arrc%]
echo counter"%strc%!i!"
echo line=%%a
java pack.Scan %strc%!i! %%a
)
pause
Inside the for loop I want the first element of the array to be printed for the first loop iteration, When the loop runs the second time the second element of the array should be printed and likewise.
Once the array completes i.e when the last item of the array is printed and the loop continues the array must start printing elements from the start i.e from the first element.
Thus for loop
run
iteration 1 must print PROD01
iteration 2 must print PROD02
iteration 3 must print PROD03
iteration 4 must print BangScan
iteration 5 must print PROD01
iteration 6 must print PROD02
and so on ...
Note: !i!
prints the iteration number of the loop.
I'm new to batch. Any help would be appreciated.