for循环中的迭代器始终给出最后一个元素批次

时间:2020-10-08 16:50:34

标签: batch-file

所以我是批处理脚本的新手,我想要一个这样的for循环:

@echo off
for /L %%i in (1,1,20) do (
    set input_name=input%%i.txt
    echo %input_name%
)

,输出为:

input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
input20.txt
.
.
. (20 times)

为什么我总是得到迭代中的最后一个数字而不是1到20?

0 个答案:

没有答案