1,批处理与mp3在同一目录
2,如果文件名不符合条件,将不被处理
3,不包括子目录:- @echo off&setlocal enabledelayedexpansion
- for %%i in (*.mp3) do (call:xing "%%~ni"
- ren "%%i" "!ye!.mp3")
- exit
- :xing
- set "ye=%~1"&set han=
- :gu
- for /l %%j in (0,1,9) do if "!ye:~%han%,1!"=="%%j" set/a han+=1&goto:gu
- if not "%han%"=="" set ye=!ye:~%han%!
- if "%ye:~0,1%"=="." set ye=%ye:~1%
复制代码 或是- @echo off&setlocal enabledelayedexpansion
- for %%i in (*.mp3) do (call:xing "%%~ni"
- ren "%%i" "!ye!.mp3")
- exit
- :xing
- set "ye=%~1"&set han=
- :gu
- for %%j in (0,1,2,3,4,5,6,7,8,9,.) do if "!ye:~%han%,1!"=="%%j" set/a han+=1&goto:gu
- if not "%han%"=="" set ye=!ye:~%han%!
复制代码
[ 本帖最后由 hanyeguxing 于 2010-5-9 00:05 编辑 ] |