Changing a file extension

Tip: Although any file can be renamed, it doesn't mean that, 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.

File list in explorer with name and file extension

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

Windows 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.

  1. Right-click on the file (not the shortcut)
  2. Select Rename in the menu
  3. Erase the .txt from myfile.txt.
  4. Type .doc (it is important to have the dot).

Renaming multiple file extensions

If you want to rename or change the file extensions of multiple files, we recommend you enter MS-DOS from Windows and use the MS-DOS steps below.

MS-DOS and Windows command line users

Get to an MS-DOS or Windows command line.

Change the directory to the location of where the file is located. In our example below, 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.

  • See the move command page for more information about this command.

Renaming multiple file extensions

If you want to rename multiple files that have the same file extension without the aid of a different program, we recommend you follow the steps below.

The example below will rename all the files in the current directory that end with .txt to .old.

ren *.txt *.old

Unix and Linux users

Change the directory to the location of where the file is located. In our example below, 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 more information on this command.

Additional information