How to Rename a File and Folder from the Command Prompt
InformationThis will show you how to rename a file and folder using the REN or RENAME command from within a command prompt. This can be handy if you cannot rename the file or folder normally.
Normally you would just right click on the file or folder, click on Rename, and type in a new name for it.NoteWhile you can run this command in a non-elevated or elevated command prompt, you would get the best results using a elevated command prompt.
EXAMPLE: REN and RENAME Command
NOTE: You can use either the REN or RENAME command in the command prompt. They are the same command.
OPTION ONETo Rename a File from the Command Prompt
1. To Use a Elevated Command Prompt in Windows
A) Make sure that the file is not set to be hidden.B) Open Folder Options and uncheck the Hide extensions for known file types option and click on OK. (see screenshot below)2. To Use a Command Prompt at Boot
NOTE: This way you will be able to see the file extension in your file's name to use in the command below.
C) Open a elevated command prompt.
D) Go to step 3.
A) Open a command prompt at boot.3. In the command prompt, type the command below and press enter.
B) In the command prompt, type diskpart and press Enter. (see screenshot below)
C) In the command prompt, type list volume and press Enter. (see screenshot below)
NOTE: This will let you see what the drive letter is for the drive that you want to delete the file in since it may not always be the same drive letter that it is in Windows.
D) After making note of the drive letter, type exit and press Enter. (see screenshot below)
NOTE: Substitute Full Path of File with extension within quotes below with your files's full path and name with the extension included within quotes instead. Substitute New File Name with extention within quotes below with only the new name and file extension you want to rename the file with.
NOTE: For example, if I wanted to rename a text file named File1 with the file extenstion .txt on my desktop to File2 with it keeping the same .txt file extension, I would type this command below.Code:REN "Full Path of File with extension" "New File Name with extension"
4. The file should now be renamed. Close the command prompt.Code:REN "C:\Users\UserName\Desktop\File1.txt" "File2.txt"
OPTION TWOTo Rename a Folder from the Command Prompt
1. To Use a Elevated Command Prompt in WindowsThat's it,
A) Make sure that the folder is not set to be hidden.2. To Use a Command Prompt at Boot
A) Open a command prompt at boot.3. In the command prompt, type the command below and press enter.
B) In the command prompt, type diskpart and press Enter. (see screenshot below)
C) In the command prompt, type list volume and press Enter. (see screenshot below)
NOTE: This will let you see what the drive letter is for the drive that you want to delete the file in since it may not always be the same drive letter that it is in Windows.
D) After making note of the drive letter, type exit and press Enter. (see screenshot below)
NOTE: Substitute Full Path of Folder within quotes below with your folder's full path and name within quotes instead. Substitute New Folder Name within quotes below with only the new name you want to rename the folder with.
NOTE: For example, if I wanted to rename a folder named Folder Name1 on my desktop to Folder Name2, I would type this command below.Code:REN "Full Path of Folder" "New Folder Name"
4. The folder should now be renamed. Close the command prompt.Code:REN "C:\Users\UserName\Desktop\Folder Name1" "Folder Name2"
Shawn