未测试,测试时先备份所有文件。。切记。。。。。
:- @echo off&set . .=a
- for /l %%a in (0 1 9) do set .%%a.=a
- for /f "delims=" %%a in ('dir/b/a-d *.mp3') do (
- set "num=%%~na"&set "num2=%%a"
- setlocal enabledelayedexpansion
- call :loop1
- if not exist "!Num!..mp3" (ren "!num2!" "!Num!..mp3") else (del /q "!num2!")
- endlocal
- )
- pause&exit
- :loop1
- set "var1=!num:~0,1!"
- if defined .!var1!. set "num=!num:~1!"&goto loop1
- :loop2
- set "var2=!num:~-1!"
- if defined .!var2!. set "num=!num:~0,-1!"&goto loop2
- goto :EOF
复制代码
[ 本帖最后由 随风 于 2009-4-22 18:17 编辑 ] |