本帖最后由 PakTC 于 2014-5-7 20:06 编辑

重命名这种事情要是没有特殊控制字符干嘛要用vbs?
回复 14# CrLf - @echo off
- setlocal enabledelayedexpansion
- for /l %%a in (1,1,99) do (
- set sn=0%%a
- set sn=!sn:~-2!
- if exist *[!sn!]*.txt (
- call :next *[!sn!]*.txt !sn!
- )
- )
- echo 修改之后的文件列表:
- dir /b *.txt
- pause
- exit
-
- :next
- echo "%~f1"
- ren "%~f1" !sn!.txt
复制代码 输出结果
"C:\新建文件夹\###[01]#####.txt"
"C:\新建文件夹\复件 ###[02]#####.txt"
"C:\新建文件夹\复件 (3) ###[03]#####.txt"
"C:\新建文件夹\复件 (2) ###[04]#####.txt"
修改之后的文件列表:
01.txt
02.txt
03.txt
04.txt |