SoFunction
Updated on 2025-04-08

What should be paid attention to when using wildcards in the ren command

1、
ren full file name *Specify any character or continuous string in the full file name. Extension
Change the file name to: Wild from the beginning of the original file name to the specified character (string). Extension
like:
ren *
ren *
ren *

2、
ren full file name *Specify a string with a non-continuous complete file name. Extension
Change the file name to: Wild from the beginning of the original file name to the specified string first character + the remaining string content. Extension
like:
ren *
ren *

3、
ren full file name *Specify any character (string) except the complete file name. Extension
Change the file name to: Wild complete file name + specified character (string). Extension
like
ren *




Originally posted by bjsh at 2007-4-13 10:10 PM:
Create a new one on disk c
Execute the following two commands;
See what was finally changed to /

ren *
The result is: 10.

ren *
The result is


ren *

*What is the first word behind?
2
Is there any word in it?
no. So, follow it in the back



10.

ren *

*What is the first word behind?
1

Is there any word in it?
have. Looking forward from behind, the first one I found,

1. Delete later
1. Continue later




ren *

*What is the first word behind?
1

Is there any word in it?
have. Looking forward from behind, the first one I found,


1. Delete later
1. Continue later




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"