【发布时间】:2021-06-13 16:48:24
【问题描述】:
我想知道是否有可能或其他方式得到这个:
@echo off
setlocal enableDelayedExpansion
SET loopcount=3
SET variable1=test1
SET variable2=test2
SET variable3=test3
for /l %%x in (1, 1, %loopcount%) do {
echo %variable%%x%
}
正如您在 echo 中看到的那样,我想获取 variable1 的值,即 test1 等等......有什么解决方法吗?谢谢。
【问题讨论】:
-
试试
call echo %%variable%%x%%或echo !variable%%x! -
甚至:
For /L %%x in (1 1 3)Do For /F "Tokens=2* Delims==" %%G in (' Set "Variable%%x" 2^> nul ')Do Echo(%%G
标签: batch-file variables cmd