Originally posted by bjsh at 2007-4-13 10:10 PM:
在c盘新建一个10.pdf
执行下面的两句命令;
看看最后10.pdf 被改名成了什么/
ren 10.pdf *2.c
结果为: 10.pdf2.c
ren 10.pdf *1.c
结果为1.c
ren 10.pdf *2.c
*後面的第一個字是什麼?
2
10.pdf中有沒有這個字?
沒有。所以,接在後面
10.pdf
2.c
10.pdf2.c
ren 10.pdf *1.c
*後面的第一個字是什麼?
1
10.pdf中有沒有這個字?
有。從後面往前找,找到的第一個,對齊
10.pdf 1以後刪除
1.c 1以後接上
1.c
ren 10010.pdf *1.c
*後面的第一個字是什麼?
1
10010.pdf中有沒有這個字?
有。從後面往前找,找到的第一個,對齊
10010.pdf 1以後刪除
1.c 1以後接上
1001.c
特例 ren * *.
ren * "* "
FAT32
C:\TEST>cd.>123...456...789.mp3
C:\TEST>dir/b
123...456...789.mp3
C:\TEST>ren * *.
C:\TEST>dir/b
123...456...789
C:\TEST>ren * *.
C:\TEST>dir/b
123
---
C:\TEST>cd.>"123 456 789.mp3"
C:\TEST>dir/b
123 456 789.mp3
C:\TEST>ren * "* "
C:\TEST>dir/b
123
C:\TEST>for %a in (*) do @echo "%a"
"123"
NTFS
D:\TEST>cd.>123...456...789.mp3
D:\TEST>dir/b
123...456...789.mp3
D:\TEST>ren * *.
D:\TEST>dir/b
123...456...789
D:\TEST>ren * *.
D:\TEST>dir/b
123...456
D:\TEST>ren * *.
D:\TEST>dir/b
123
---
D:\TEST>cd.>"123 456 789.mp3"
D:\TEST>dir/b
123 456 789.mp3
D:\TEST>ren * "* "
D:\TEST>dir/b
123 456
D:\TEST>for %a in (*) do @echo "%a"
"123 456"
D:\TEST>ren * "* "
D:\TEST>dir/b
123
D:\TEST>for %a in (*) do @echo "%a"
"123"
Last edited by mkd on 2008-4-28 at 05:42 PM ]
Originally posted by bjsh at 2007-4-13 10:10 PM:
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
ren 10.pdf *2.c
What is the first character after *?
2
Is there this character in 10.pdf?
No. So, it is appended at the end
10.pdf
2.c
10.pdf2.c
ren 10.pdf *1.c
What is the first character after *?
1
Is there this character in 10.pdf?
Yes. Find the first one from the end, and align
10.pdf Delete after 1
1.c Append after 1
1.c
ren 10010.pdf *1.c
What is the first character after *?
1
Is there this character in 10010.pdf?
Yes. Find the first one from the end, and align
10010.pdf Delete after 1
1.c Append after 1
1001.c
Special case ren * *.
ren * "* "
FAT32
C:\TEST>cd.>123...456...789.mp3
C:\TEST>dir/b
123...456...789.mp3
C:\TEST>ren * *.
C:\TEST>dir/b
123...456...789
C:\TEST>ren * *.
C:\TEST>dir/b
123
---
C:\TEST>cd.>"123 456 789.mp3"
C:\TEST>dir/b
123 456 789.mp3
C:\TEST>ren * "* "
C:\TEST>dir/b
123
C:\TEST>for %a in (*) do @echo "%a"
"123"
NTFS
D:\TEST>cd.>123...456...789.mp3
D:\TEST>dir/b
123...456...789.mp3
D:\TEST>ren * *.
D:\TEST>dir/b
123...456...789
D:\TEST>ren * *.
D:\TEST>dir/b
123...456
D:\TEST>ren * *.
D:\TEST>dir/b
123
---
D:\TEST>cd.>"123 456 789.mp3"
D:\TEST>dir/b
123 456 789.mp3
D:\TEST>ren * "* "
D:\TEST>dir/b
123 456
D:\TEST>for %a in (*) do @echo "%a"
"123 456"
D:\TEST>ren * "* "
D:\TEST>dir/b
123
D:\TEST>for %a in (*) do @echo "%a"
"123"
Last edited by mkd on 2008-4-28 at 05:42 PM ]