How to Rename File in CMD [Command Prompt]

By | March 20, 2022

Windows’ command prompt (CMD) allows us to rename files using the rename command. The syntax and examples of this command are below.

How to Rename File in CMD –

How to Rename File in CMD [Command Prompt]
Command syntax for rename:

rename  file_path  new_name

Example:

rename  d:\data\file1.doc file2.doc

The file2.doc will appear in the folder d:/data after running the above command.

Both rename and ren are aliases for one another.

Found the Errors:

A. Renaming the files fails with the below error if they are used by an application.

C:\>rename data.xlsx newdata.xlsx
The process cannot access the file because it is being used by
another process.
C:\>

B. In order to rename the file, you must also have sufficient privileges.

c:\>rename c:\windows\csc test
Access is denied.
c:\>

C. A file is not converted from one type to another when it is renamed; it changes only the file name. The file format remains the same even if you change a filename from mp4 to mp3.

If a doc file is named mydocument.docx and renamed to mydocument.pdf, Acrobat Reader cannot open the file.

You may also like: Run Command for Device Manager – CMD from as Admin

Leave a Reply

Your email address will not be published. Required fields are marked *