

CODE: [Copy to clipboard][ Last edited by wxcute on 2008-2-12 at 05:22 AM ]@echo off
setlocal enabledelayedexpansion
set T=---
set a=3
for /f "delims=" %%i in ('dir /b *.txt') do (
for /f "tokens=1,2* delims=-" %%d in ('dir /b "%%i"') do (
set /a n=0
set oldn="%%i"
set newn0=%%~nd
set newn1="%%~nd!T!!a!.txt"
if not !oldn!==!newn1! (
if exist !newn1! (call :anum) else (
ren !oldn! !newn1!
)
)
)
)
goto :end
:anum
set /a n+=1
set newn2="!newn0!!n!!T!!a!.txt"
if exist !newn2! (goto :anum) else (
ren !oldn! !newn2!
)
goto :eof
:end
goto :eof
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |