We can use the command
rename to rename files from windows command prompt(CMD). Find below syntax of the command with examples.
Syntax of rename command:
rename file_path new_name
rename d:\data\file1.doc file2.doc
After executing the above command we’ll have file2.doc in the folder d:\data
Ren is alias for
rename, so both refer to the same command.
- If the files is being used by a program, then rename command fails with below error.
C:\>rename data.xlsx newdata.xlsx The process cannot access the file because it is being used by another process. C:\>
- You also need to have sufficient privileges to rename the file.
c:\>rename c:\windows\csc test Access is denied. c:\>
- Rename changes just the file name, it does not convert a file from one type to another. For example, if you rename a file from
mp3extension, it does not change the file format. Renaming a doc file
'mydocument.pdf'does not make the file readable in Acrobat Reader.