Changing a file extension.
Issue
Changing a file extension.
Solution
Although any file can be
renamed, it doesn't mean after it has been renamed it can be opened with any
program. For example, you can rename a .BAT to a .EXE, however it will not
run because a .EXE file is a compiled file.
Below is a listing of how to change the file extension for each of the major IBM compatible operating systems.
Windows users
MS-DOS and
Windows command line users
Unix and Linux users
Before renaming a Windows file extension you must have show file extensions enabled. By default this option is disabled.
Using the same examples as we did earlier, assuming the file is named myfile.txt, we will rename it to myfile.doc.
- right-click on the file (not the shortcut)
- Click Rename
- Erase the .txt from myfile.txt.
- Type .doc (it is important to have the dot).
Renaming multiple file extensions
If you wish to rename or change the file extensions of multiple files we recommend you enter MS-DOS from Windows and use the above MS-DOS steps.
MS-DOS and Windows command line users
Get to a MS-DOS or Windows command line.
Change the directory to the location of where the file is located. In our below example we will rename the file myfile.txt to myfile.doc.
move myfile.txt myfile.doc
Unless the file already exists you should receive an [ok] message indicating that the file has been renamed.
Additional help and information about move can be found on our move page.
Renaming multiple file extensions
If you wish to rename multiple files that have the same file extension without the aid of a different program we recommend you follow the below steps.
The below example will rename all the files in the current directory that end with .txt to .old.
ren *.txt *.old
- See the ren or rename command page for additional information about these commands.
Change to the directory to the location of where the file is located. In our below example we will rename the file myfile.txt to myfile.htm. Additionally, this example is done from the shell and not a GUI.
mv myfile.txt myfile.htm
Unless an error occurs you should be returned back to the shell prompt
- See the mv command page for further information on this command.
