None of these seemed to work for me:
@ECHO OFF
REM 1. Initialize our counter
SET /A "c=0"
REM Iterate through a dummy list.
REM Notice how the counter is used: "CALL ECHO %%c%%"
FOR /L %%i in (10,1,20) DO (
REM 2. Increment counter
SET /A "c+=1"
REM 3. Print our counter "%c%" and some dummy data "%%i"
CALL ECHO Line %%c%%: - Data: %%i
)
The answer was extracted from: https://www.tutorialspoint.com/batch_script/batch_script_arrays.htm (Section: Length of an Array)
Result:
Line 1: - Data: 10
Line 2: - Data: 11
Line 3: - Data: 12
Line 4: - Data: 13
Line 5: - Data: 14
Line 6: - Data: 15
Line 7: - Data: 16
Line 8: - Data: 17
Line 9: - Data: 18
Line 10: - Data: 19
Line 11: - Data: 20