Monday, February 28, 2011

How to Rename Files on the Command Line


Renaming files is a very easy task on Windows operating system. All you have to do is select the file and right click on it. Then you just have to choose the option Rename, and can type the new name of the file. Finally, pressing Enter (or Return) key will change the name of the file to the new one. Instead of right clicking on the file, you can also select the file and hit F2 on the keyboard.
However, what can be done if you want to rename a file using command prompt of Windows? It is not very difficult, either. All you have to do is run a simple command and your file will be renamed. Here's how you can do it:
1. Click on Start button and click on Run.
2. In the box named Open, type command, or cmd and hit Enter (or Return) key.
3. The command prompt will open. Type CD to switch to the folder where the file (which you wish to rename) is stored.
4. Now, there are two commands you can use. Both are equally effective; it is just a matter of preference on your part.
5. For the first case, type: RENAME [drive:][path] filename1 filename2 (where drive is the partition in your hard disk where the file is stored, path is the full path of the file location, filename1 is the present name of the file, and filename2 is the new name that you want to give to the file).
6. For the second case, type: REN [drive:][path]filename1 filename2 (where the drive is the partition in your hard drive where you have the file, path is the full path of the present location of the file including names of folders or subfolders, filename1 is the current name of the file, and filename2 is the new name you are going to assign to the file).
7. In each case, hit Enter (or Return) key when you are entering the command at the prompt.
8. Once you are done, type Exit at the command prompt.
The command prompt will close. Your file should have been renamed by now. You can verify it by accessing the folder where the file is located. This process does not support long file names though, so make sure that the file you wish to rename by this method has a short and easy name.



No comments:

Post a Comment