China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-06 03:02
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to batch rename filenames that follow a pattern? View 902 Replies 3
Original Poster Posted 2007-10-11 23:58 ·  中国 浙江 台州 天台县 电信
新手上路
Credits 4
Posts 1
Joined 2007-10-11 23:07
18-year member
UID 99491
Gender Male
Status Offline
Floor 2 Posted 2007-10-12 00:17 ·  中国 浙江 杭州 电信
初级用户
Credits 76
Posts 29
Joined 2007-10-02 02:39
18-year member
UID 98748
Gender Male
Status Offline
echo off
cd\
cd \d 路径
for /f "tokens=1*" %%a in ('dir /b/s/a-d *.mp3') do (
copy %%~sa "%%b" &&del%%~sa
)
pause

2.------------------------------------

echo off
cd\
cd \d 路径
for /f "tokens=1,2" %%a in ('dir /b/s/a-d *.mp3') do (
copy %%~sa "%%b.mp3" &&del%%~sa
)
pause


Untested, make a backup before running it

[ Last edited by guixi on 2007-10-12 at 12:19 AM ]
Floor 3 Posted 2007-10-12 09:43 ·  中国 广东 广州 荔湾区 电信
初级用户
★★
Credits 136
Posts 51
Joined 2007-08-04 21:31
19-year member
UID 94657
Gender Male
Status Offline
Have you tested it??
Doesn't seem like it'll work...
What did you use to split it?
Floor 4 Posted 2007-10-12 10:08 ·  中国 四川 南充 营山县 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Forum Jump: