1
SETLOCAL EnableDelayedExpansion

SET str=123456789abcdefgh

FOR /l %%x IN (1, 1, 10) DO (

    SET /a intLength=10-%%x

    SET result=!str:~-%%x!
    ECHO "Works as intended: " !result!

    SET result=!str:~-intLength!
    ECHO "Does NOT work as intended: " !result!
)

endlocal
4

1 に答える 1