I have a batch-script with multiple arguments. I am reading the total count of them and then run a for loop like this:
@echo off
setlocal enabledelayedexpans
here's one way to access the second (e.g.) argument (this can be put in for /l loop):
@echo off
setlocal enableDelayedExpansion
set /a counter=2
call echo %%!counter!
endlocal
so:
setlocal enableDelayedExpansion
set /a counter=0
for /l %%x in (1, 1, %argCount%) do (
set /a counter=!counter!+1
call echo %%!counter!
)
endlocal