我试图在 for 循环中读取字符串的字符。
命令 !string:~1,3! 工作正常。但是我可以用变量而不是1和3来做到这一点吗?我尝试了以下代码,但我不知道出了什么问题。它不工作。
@echo off
setlocal enableextensions enabledelayedexpansion
set string=abcdefghij
set /a count=1
for /l %%x in (1,1,3) do (
set string2=!string:~%count%,1!
set /a count+=1
echo !string2!
pause
)
但它总是给出输出:
b
我希望输出为:
b
c
d
请帮助解决这个问题..提前非常感谢