中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-08-11 16:20
47,811 topics / 349,897 posts / today 0 new / 48,256 members
DOS批处理 & 脚本技术(批处理室) » Is this a bug of ren?
Printable Version  8,261 / 18
Floor1 bjsh Posted 2007-04-13 22:10
银牌会员 Posts 621 Credits 2,000
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
Floor2 htysm Posted 2007-04-13 23:03
高级用户 Posts 415 Credits 866
This "*" is a wildcard. Can wildcards be used for file names?
Floor3 bjsh Posted 2007-04-14 04:10
银牌会员 Posts 621 Credits 2,000
Brother ls, don't you know the magic of "ren *.pdf *.c"?
Floor4 zh159 Posted 2007-04-14 05:18
金牌会员 Posts 1,467 Credits 3,687
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.
Floor5 bjsh Posted 2007-04-14 05:29
银牌会员 Posts 621 Credits 2,000
But what is the difference between *1.c and *2.c? Why is one 1.c and the other is 10.pdf2.c
Floor6 kcdsw Posted 2007-04-14 08:02
中级用户 Posts 179 Credits 404
```
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 ]
Floor7 bjsh Posted 2007-04-14 09:11
银牌会员 Posts 621 Credits 2,000
Thanks to ls;

Suddenly enlightened ah!!
Floor8 59fei Posted 2007-07-09 02:42
初级用户 Posts 23 Credits 60
What a sudden enlightenment?
Little brother still doesn't understand?
Can the landlord specifically talk about it?
Floor9 bjsh Posted 2007-07-09 08:46
银牌会员 Posts 621 Credits 2,000
After 59fei receives my private message, please post the private message here.
Floor10 tclgb Posted 2007-07-09 10:04
初级用户 Posts 26 Credits 76
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 ]
Floor11 slore Posted 2007-07-09 11:29
铂金会员 Posts 2,478 Credits 5,212

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
Floor12 tyh Posted 2007-07-09 12:55
初级用户 Posts 43 Credits 80
Floor13 qinbuer Posted 2007-07-09 13:02
高级用户 Posts 228 Credits 512
Unexpectedly, REN has such a useful application, add points, collect and learn.
Floor14 bush Posted 2007-07-09 23:06
银牌会员 Posts 730 Credits 2,165
My result is different:
ren 10.pdf *2.c

The result is: 10.c

ren 10.pdf *1.c

The result is 10.c
Floor15 plp626 Posted 2008-04-26 22:21
银牌会员 Posts 1,020 Credits 2,278
Eyes, your eyes are all blurry. Under what circumstances do you have to use ren like this?
1 2  Next
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023