for %%n in (*.jpg)

新建txt文件,复制下边的代码

@echo off
set a=1
setlocal EnableDelayedExpansion
for %%n in (*.jpg) do (
set /A a+=1
ren "%%n" "前缀!a!.jpg"
)

注释:

a——起始值

setlocal EnableDelayedExpansion——设置同级目录文件

for %%n in (*.jpg)——遍历后缀为jpg的文件

"前缀!a!.jpg"——组成:前缀名、下标、文件类型

posted on 2022-02-14 16:12  陌洛  阅读(306)  评论(0编辑  收藏  举报