How To Rename Files and Folders in Windows CMD

The ren
(or rename
) command can be used to rename files and folders in the Window command prompt (CMD).
The syntax of the rename
command is as follows:
rename file-name new-file-name
Examples
Rename file1.txt to file2.txt:
ren file1.txt file2.txt

Rename the name of a directory from Pictures to Documents:
ren Pictures Documents

Use quotation marks if the file or folder name contains spaces:
ren "New folder" "Documents"
The ren
command supports wildcards to rename multiple files at once. For example, the following command renames the extension of all files in a folder (from .txt
to .doc
):
ren *.txt *.doc
Note that you can’t move files from one directory to another with the ren
command. For that, use the move command.