0
我有一个bat文件,将所有png文件重命名为data_文件。它开始从data_1
和data_2
....我想从data_140
和data_141
开始...用特定号码的bat文件重命名
如何做到这一点?
:: Renaming files
for %%a in (*.png) do (
set /a count+=1
set "fname=%%~a"
setlocal enabledelayedexpansion
ren "!fname!" data_!count!.png
endlocal
)
有什么问题吗? '只需在'for'之前预置'count'变量即可。 – Stephan
你不需要预设你的'count'变量。来自'help set':“如果指定了一个环境变量名称,但在当前环境中没有定义,那么[使用'/ A'开关]使用零值。” – indiv
@indiv:我的意思是用'set count = 139'来预设它。对不起,我想,这很明显。 – Stephan