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-06-27 16:43
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Is this a bug of ren? View 7,929 Replies 18
Original Poster Posted 2007-04-13 22:10 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Create a 10.pdf in the C drive.

Execute the following two commands;

See what 10.pdf is renamed to in the end /

ren 10.pdf *2.c

The result is: 10.pdf2.c

ren 10.pdf *1.c

The result is 1.c
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
qinbuer +4 2007-07-09 13:03
Floor 2 Posted 2007-04-13 23:03 ·  中国 安徽 芜湖 电信
高级用户
★★★
Credits 866
Posts 415
Joined 2005-12-04 11:19
20-year member
UID 46459
Status Offline
This "*" is a wildcard. Can wildcards be used for file names?
Floor 3 Posted 2007-04-14 04:10 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Brother ls, don't you know the magic of "ren *.pdf *.c"?
Floor 4 Posted 2007-04-14 05:18 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
The two usages are fundamentally different. The filename and extension are processed separately: ren *.pdf *.c, regardless of what the filename is, only the extension is changed.
Floor 5 Posted 2007-04-14 05:29 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
But what is the difference between *1.c and *2.c? Why is one 1.c and the other is 10.pdf2.c
Floor 6 Posted 2007-04-14 08:02 ·  中国 北京 鹏博士BGP
中级用户
★★
Credits 404
Posts 179
Joined 2006-03-30 14:44
20-year member
UID 53056
Status Offline
```
ren 10.pdf *0.c
ren 10.pdf *p.c
ren 10.pdf *d.c



Not a bug

[ Last edited by kcdsw on 2007-4-14 at 08:03 AM ]
Floor 7 Posted 2007-04-14 09:11 ·  中国 浙江 杭州 华数宽带
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
Thanks to ls;

Suddenly enlightened ah!!
Floor 8 Posted 2007-07-09 02:42 ·  中国 山东 滨州 联通
初级用户
Credits 60
Posts 23
Joined 2007-07-05 00:44
18-year member
UID 93170
Gender Male
Status Offline
What a sudden enlightenment?
Little brother still doesn't understand?
Can the landlord specifically talk about it?
Floor 9 Posted 2007-07-09 08:46 ·  中国 浙江 杭州 电信
银牌会员
★★★
Credits 2,000
Posts 621
Joined 2007-01-01 00:00
19-year member
UID 75212
Gender Male
Status Offline
After 59fei receives my private message, please post the private message here.
Floor 10 Posted 2007-07-09 10:04 ·  中国 湖北 武汉 电信
初级用户
小子
Credits 76
Posts 26
Joined 2007-06-20 19:30
19-year member
UID 91913
Gender Male
Status Offline
1、
ren full file name *any character or consecutive string in the specified full file name. extension
Rename the file to: wildcard from the beginning of the original file name to the specified character (string). extension
For example:
ren 10.pdf *0.c gets 10.c
ren 10.pdf *p.c gets 10.p.c
ren 10.pdf *d.c gets 10.pd.c

2、
ren full file name *non-consecutive string in the specified full file name. extension
Rename the file to: wildcard from the beginning of the original file name to the first character of the specified string + remaining string content. extension
For example:
ren 10.pdf *1p.c gets 1p.c
ren 10.pdf *0dp.c gets 10dp.c

3、
ren full file name *any character (string) in the specified full file name. extension
Rename the file to: wildcard full file name + specified character (string). extension
For example
ren 10.pdf *mm.c gets 10.pdfmm.c

The summary is a bit complicated, I hope brothers can simplify it
: Thank you for the reminder from the downstairs, hehe

[ Last edited by tclgb on 2007-7-9 at 10:31 PM ]
Recent Ratings for This Post ( 3 in total) Click for details
RaterScoreTime
everest79 +15 2007-07-09 10:09
qinbuer +4 2007-07-09 13:02
qianmo717 +2 2008-09-13 07:22
Floor 11 Posted 2007-07-09 11:29 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline

3、
ren full file name *any character(s) except the full file name. extension
Rename the file to: wildcard full file name + specified character(s). extension
For example:
ren 10.pdf *mm.c gets 10.pdf1p.c

Is that a typo?
10.pdfmm.c
Floor 12 Posted 2007-07-09 12:55 ·  中国 江苏 无锡 电信
初级用户
Credits 80
Posts 43
Joined 2007-04-21 23:44
19-year member
UID 86017
Gender Male
Status Offline
Floor 13 Posted 2007-07-09 13:02 ·  中国 广东 佛山 电信
高级用户
★★
我思故我在
Credits 512
Posts 228
Joined 2007-01-21 10:31
19-year member
UID 77225
Gender Male
Status Offline
Unexpectedly, REN has such a useful application, add points, collect and learn.
我确实是只菜鸟,而且这里X人太多,所以我不敢装X。谁要再说我装X,我就XXOO他。
Floor 14 Posted 2007-07-09 23:06 ·  中国 重庆 电信
银牌会员
★★★
Credits 2,165
Posts 730
Joined 2004-04-21 00:00
22-year member
UID 22966
Gender Male
Status Offline
My result is different:
ren 10.pdf *2.c

The result is: 10.c

ren 10.pdf *1.c

The result is 10.c
Floor 15 Posted 2008-04-26 22:21 ·  中国 陕西 西安 电信
银牌会员
★★★★
钻石会员
Credits 2,278
Posts 1,020
Joined 2007-11-19 13:34
18-year member
UID 103127
Gender Male
Status Offline
Eyes, your eyes are all blurry. Under what circumstances do you have to use ren like this?
山外有山,人外有人;低调做人,努力做事。

进入网盘(各种工具)~~ 空间~~cmd学习
Forum Jump: