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-07-31 22:26
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to batch generate new files with the same file name as the original but different extensions? View 1,591 Replies 13
Original Poster Posted 2007-04-21 21:24 ·  中国 山东 济南 联通
初级用户
Credits 20
Posts 9
Joined 2007-04-21 00:17
19-year member
UID 85898
Gender Male
Status Offline
mencoder.exe -ffourcc FLV1 -of lavf -lavfopts E:\别拿豆包不当干粮02.rmvb -o E:\\别拿豆包不当干粮02.flv
This is the generation parameters and method of my program
Run in DOS
I want to generate all files in this folder
So mencoder.exe -ffourcc FLV1 -of lavf -lavfopts *.rmvb -o *.flv
That is, the new file has the same name as the original file. How to do it? Please help the expert!!!

[ Last edited by xlfj521 on 2007-4-21 at 08:42 AM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
huzixuan -4 2007-04-22 21:30
546474 -2 2007-04-22 22:37
chkau -2 2007-04-26 16:19
Floor 2 Posted 2007-04-21 23:08 ·  中国 山东 济南 联通
初级用户
Credits 20
Posts 9
Joined 2007-04-21 00:17
19-year member
UID 85898
Gender Male
Status Offline
What you said upstairs is wrong. If I just used ren, would I still post it here to ask? Don't you think about it
Floor 3 Posted 2007-04-21 23:10 ·  中国 浙江 杭州 联通
银牌会员
★★★
Credits 1,928
Posts 931
Joined 2007-01-06 11:46
19-year member
UID 75624
Gender Male
Status Offline
Then I'm being redundant. Consider me meddling.
Floor 4 Posted 2007-04-21 23:11 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
@echo off
for /r %%i in (*.rmvb) do ren "%%i" "%%~ni".flv
pause

The code has not been tested. If there is any problem, please post a reply.

[ Last edited by htysm on 2007-4-21 at 11:15 PM ]
欢迎你到批处理爱好者联盟QQ群:18023953
Floor 5 Posted 2007-04-21 23:36 ·  中国 重庆 长寿区 电信
初级用户
Credits 101
Posts 47
Joined 2007-04-18 16:05
19-year member
UID 85634
Gender Male
Status Offline
for /f "skip=5 tokens=4 delims=. " %i in ('dir *.rmvb') do del %i.rmvb&imencoder.exe -ffourcc FLV1 -of lavf -lavfopts %i.rmvb -o %i.flv
Try it yourself

[ Last edited by chkau on 2007-4-21 at 07:20 PM ]
Floor 6 Posted 2007-04-21 23:41 ·  中国 重庆 长寿区 电信
初级用户
Credits 101
Posts 47
Joined 2007-04-18 16:05
19-year member
UID 85634
Gender Male
Status Offline
.......I also followed and went silly
for /f "skip=5 tokens=4 delims=. " %i in ('dir *.rmvb') do del %i.rmvb&imencoder.exe -ffourcc FLV1 -of lavf -lavfopts %i.rmvb -o %i.flv

[ Last edited by chkau on 2007-4-21 at 07:19 PM ]
Floor 7 Posted 2007-04-21 23:48 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
If simply changing "*.rmvb" to "*.flv", you can directly use "ren *.rmvb *.flv".
Floor 8 Posted 2007-04-21 23:50 ·  中国 重庆 长寿区 电信
初级用户
Credits 101
Posts 47
Joined 2007-04-18 16:05
19-year member
UID 85634
Gender Male
Status Offline
He is going to change the RMVB video file into a flash file. Just renaming it is a bunch of unexecutable junk files
Floor 9 Posted 2007-04-21 23:51 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Originally posted by chkau at 2007-4-21 10:50:
He was going to change the RMVB video file into a flash file. Just renaming it directly results in a bunch of unexecutable garbage files.

That's not called renaming at all, it's purely format conversion. Then the initial title was off-topic.
Floor 10 Posted 2007-04-22 00:15 ·  中国 重庆 长寿区 电信
初级用户
Credits 101
Posts 47
Joined 2007-04-18 16:05
19-year member
UID 85634
Gender Male
Status Offline
Just now, the LZ purely misled people. I only understood what was going on after reading it for a long time
Floor 11 Posted 2007-04-22 21:30 ·  中国 安徽 芜湖 电信
高级用户
★★
Credits 537
Posts 219
Joined 2006-10-31 21:08
19-year member
UID 69036
Gender Male
From 芜湖
Status Offline
江湖远
碧空长
路茫茫

一个人漫无目的的奔跑,风,刺骨的冷....
Floor 12 Posted 2007-04-22 22:11 ·  中国 河北 廊坊 三河市 移动
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
The landlord's problem really can't be solved just by changing the name. It is suggested that the landlord should first make up for computer knowledge.
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 13 Posted 2007-04-23 05:18 ·  中国 湖北 武汉 电信
版主
★★★★★
Credits 11,386
Posts 4,938
Joined 2006-07-23 17:10
20-year member
UID 59080
Status Offline
The title of the owner and the content of the post do have some discrepancies, which can be seen as a format conversion.


@Echo off
for /f "delims=" %%a in ('dir /s/b/a-d *.rmvb') do (mencoder.exe -ffourcc FLV1 -of lavf -lavfopts "%%a" -o "%%~dpna.flv"
Floor 14 Posted 2008-02-19 00:24 ·  中国 广东 梅州 电信
新手上路
Credits 13
Posts 8
Joined 2008-02-18 23:26
18-year member
UID 110928
Gender Male
Status Offline
Just came to learn DOC, can't understand it.
Forum Jump: