rename [Drive:][Path] filename1 filename2
ren [Drive:][Path] filename1 filename2
Examples
Suppose you want to change the extensions of all the file names in the current directory that have the extension .txt; for example, you want to change the .txt extensions to .doc extensions. To make this change, type:
ren *.txt *.doc
Examples
Rename Monday.txt as Tuesday.txt
C:\> REN Monday.txt Tuesday.txt
Substitute a character in the 1st and 3rd positions prior to any extension (adds a 2nd or 3rd character if it doesn’t exist yet)
ren * A?Z* 1 -> AZ 12 -> A2Z 1.txt -> AZ.txt 12.txt -> A2Z.txt 123 -> A2Z 123.txt -> A2Z.txt 1234 -> A2Z4 1234.txt -> A2Z4.txt
Change the (final) extension of every file
ren * *.txt a -> a.txt b.dat -> b.txt c.x.y -> c.x.txt
Append an extension to every file
ren * *?.bak a -> a.bak b.dat -> b.dat.bak c.x.y -> c.x.y.bak
Remove any extra extension after the initial extension. Note that adequate ? must be used to preserve the full existing name and initial extension.
ren * ?????.????? a -> a a.b -> a.b a.b.c -> a.b part1.part2.part3 -> part1.part2 123456.123456.123456 -> 12345.12345 (note truncated name and extension because not enough `?` were used)
Same as above, but filter out files with initial name and/or extension longer than 5 chars so that they are not truncated. (Obviously could add an additional ? on either end of targetMask to preserve names and extensions up to 6 chars long.)
ren ?????.?????.* ?????.????? a -> a a.b -> a.b a.b.c -> a.b part1.part2.part3 -> part1.part2 123456.123456.123456 (Not renamed because it doesn't match sourceMask)
Change characters after last _ in name and attempt to preserve extension. (Doesn’t work properly if _ appears in extension.)
ren *_* *_NEW.* abcd_12345.txt -> abcd_NEW.txt abc_newt_1.dat -> abc_newt_NEW.txt abcdef.jpg (Not renamed because it doesn't match sourceMask) abcd_123.a_b -> abcd_123.a_NEW (not desired, but no simple RENAME form will work in this case)
Any name can be broken up into components that are delimited by . characters may only be appended to or deleted from the end of each component. Characters cannot be deleted from or added to the beginning or middle of a component while preserving the remainder with wildcards. Substitutions are allowed anywhere.
ren ??????.??????.?????? ?x.????999.*rForTheCourse part1.part2 -> px.part999.rForTheCourse part1.part2.part3 -> px.part999.parForTheCourse part1.part2.part3.part4 (Not renamed because it doesn't match sourceMask) a.b.c -> ax.b999.crForTheCourse a.b.CarPart3BEER -> ax.b999.CarParForTheCourse
A sourceMask with at least 8 ? for the name and at least 3 ? for the extension will match all files because it will always match the short 8.3 name.
ren ????????.??? ?x.????999.*rForTheCourse part1.part2.part3.part4 -> px.part999.part3.parForTheCourse