我试过了
set /p input2=
FOR /L %%i IN (1,1,%input2%) do ren text_%%i.txt worked_%%i+11.txt
它只是尝试将 text_1.txt 重命名为 worked_1+11.txt 我该怎么做?
提前致谢
最佳答案
根据我的理解,你想要一个数学加法的问题。所以你需要 delayed expansion和 set/a
:
@echo off
set /p input2=provide a number
setlocal enableDelayedExpansion
FOR /L %%i IN (1;1;%input2%) do (
set num=%%i
set /a nump11=num+11
ren text_%%i.txt worked_!nump11!.txt
)
关于batch-file - 我如何将 11 添加到 %%i?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28589362/