- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d') do (
- for /f "tokens=1-4" %%a in ("%%i") do (
- if not "%%i"=="%~nx0" ren "%%i" "%%a%%b%%c%%d"||del /f "%%i"
- ))
- for /f "delims=" %%i in ('dir /b /a-d') do (
- if not "%%i"=="%~nx0" (
- set /a x+=1
- ren "%%i" "!x!.%%i"
- ))
复制代码 这段代码实现了,当前文件夹下,所有文件加上序号。
现在我希望是:只给没有序号的文件加序号,有序号的就不加了。是不是可以?怎么修改? |