ren commands to be aware of when using wildcard characters _dos/bat

Source: Internet
Author: User
1,
ren full file name * Specifies any character or consecutive string in the full file name. extension name
Change file name: From the beginning of the original file name to the specified character (string). Extension name
Such as:
ren 10.pdf *0.c to 10.c
ren 10.pdf *p.c 10.p.c.
ren 10.pdf *d.c 10.pd.c.

2,
ren full filename * Specifies a string that is not contiguous with the full file name. extension
The file name is: From the beginning of the original file name to the specified string first and the remaining string contents. Extension Name
Such as:
ren 10.pdf *1p.c 1p.c.
ren 10.pdf *0dp.c 10dp.c.

3,
ren full file name * Specifies any character (string) in addition to the full file name. extension name
Change file name: Wildcard full file name + Specify character Ningfu (string). Extension name
Such as
ren 10.pdf *mm.c 10.pdfmm.c.




Originally Posted by bjsh at 2007-4-13 10:10 PM:
Create a new 10.pdf on C disk
Execute the following two sentences;
See what the last 10.pdf was renamed

ren 10.pdf *2.c
The result is: 10.pdf2.c

ren 10.pdf *1.c
Result is 1.c


ren 10.pdf *2.c

* What's the first word behind?
2
Is there any word in 10.pdf?
No, it's not. So, on the back side,
10.pdf
2.c

10.pdf2.c

ren 10.pdf *1.c

* What's the first word behind?
1

Is there any word in 10.pdf?
Yes. Look forward from behind, find the first, align

10.pdf 1 To remove
1.c 1 to connect.
1.c



ren 10010.pdf *1.c

* What's the first word behind?
1

Is there any word in 10010.pdf?
Yes. Look forward from behind, find the first, align


10010.pdf 1 To remove
1.c 1 to connect.
1001.c



Special 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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.