SETLOCAL ENABLEDELAYEDEXPANSION set /P s= for /l %%i in (0,1,11) do ( set /a e=%%i*3 set x[%%i]=%s:~!e!,2% ) echo !x[11]!