纯批可以这样(测试无误后把 echo ren 改成 ren):- @echo off
- for /f "delims=" %%a in ('dir *---*.mp3') do (
- set str=%%a
- setlocal enabledelayedexpansion
- set "new=!str---="!
- echo ren !str! "!new!.mp3"
- endlocal
- )
- pause
复制代码 bkren.exe http://bbs.bathome.net/viewthread.php?tid=13231- bkren "---\.*\.mp3" ".mp3"
复制代码 perl:- foreach $file (glob "*---*.mp3"){
- $newFile = $file;
- $newFile =~ s/---.*\././;
- rename $file,$newFile;
- }
复制代码 powershell:- Get-ChildItem *---*.mp3 | Rename-Item -NewName {$_.Name -replace '---.*\.','.'}
复制代码
|