Vbscript 通过批处理文件复制和重命名特定扩展名的文件
我有一个文件夹,里面有很多文件,比如image\u hello.png、helloworld.png、wired.png。我想复制这些文件,然后通过脚本或批处理文件将它们重命名为1.png、2.png、3.png 我不知道最好的开始方式是什么,我可以很容易地复制文件,但在那之后,我不知道如何根据扩展名重命名它们 有什么想法吗?类似这样的想法:Vbscript 通过批处理文件复制和重命名特定扩展名的文件,vbscript,batch-file,Vbscript,Batch File,我有一个文件夹,里面有很多文件,比如image\u hello.png、helloworld.png、wired.png。我想复制这些文件,然后通过脚本或批处理文件将它们重命名为1.png、2.png、3.png 我不知道最好的开始方式是什么,我可以很容易地复制文件,但在那之后,我不知道如何根据扩展名重命名它们 有什么想法吗?类似这样的想法: @echo off SET count=1 FOR /f "tokens=*" %%G IN ('dir /b *.png') DO (call :ren
@echo off
SET count=1
FOR /f "tokens=*" %%G IN ('dir /b *.png') DO (call :rename_next "%%G")
GOTO :eof
:rename_next
ren "%1" %count%.png
set /a count+=1
GOTO :eof
请看这里:
set n=1
for %%i in (*.png) do (
call ren %%i %%n%%.pn_
set /a n=n+1)
ren *.pn_ *.png