I know we could get substring like this in batch script:
SET a=abcdefgh
ECHO %a:~3,2%
But how can I get letter by a variable index? Kind like:
SET index=3
ECHO %a:~%index%,1%
I know we could get substring like this in batch script:
SET a=abcdefgh
ECHO %a:~3,2%
But how can I get letter by a variable index? Kind like:
SET index=3
ECHO %a:~%index%,1%
Since the substring operation needs a constant it has to be called in a subprocess, that's when CALL comes in handy:
SET _index=3
call set b=%%a:~%index%,1%%
echo (%b%)
See https://ss64.com/nt/syntax-substring.html for more details. SS64/nt is an excellent resource for anything batch related.