Do you have broken files with missing or messed up file extensions? If you know the file type, adding the right extension could make those files readable again. And if you have more than a few files with this issue, we have something that could save you a lot of time: batch rename the file extensions.
Introduction to File Extensions
File extensions are the letters that follow the period in a file’s name. For example, in a file named
document.doc, DOC is the file extension. The extension identifies the file type and allows the operating system to associate these files with software that supports them.
Note that in most cases you can’t simply change the file extension to convert a file from one format to another. To convert a PDF file into a Word document, for example, you need to use a conversion tool that can rewrite the entire file into the new format. If you need to convert a DAT file into a Word document, however, changing the file extensions works.
How to Make File Extensions Visible
Changing the file extension can render the file temporarily useless. To protect files from accidents, file extensions are hidden by default. To see a hidden file extension, right-click the file in question and select Properties. Under General, you’ll see the full name of the respective file, including its extension. Below the name, you’ll see a line that spells out the type of file, as well as the application that opens it.
You can make file extensions visible per default. Open File Explorer and navigate to a folder where you would like to see file extensions.
In Windows 8 and 10, go to View and set a checkmark next to File name extensions.
In Windows 7, click Organize in the top left and select Folder and search options from the menu. Switch to the View tab, scroll down until you see Hide file extensions for known file types, and remove the checkmark from that option. Click OK to save your changes.
How to Fix File Type Associations
Sometimes, file type associations get messed up, meaning Windows accidentally pairs a file type with a program that doesn’t support it. Lets say the DOC file from our example above was associated with VLC instead of Microsoft Word. Any DOC file would now open with VLC, but the media player cannot open DOC files. Fortunately, a bad file association can be fixed easily.
Right-click the affected file, select Open with from the menu, and — to permanently change the associated application — select Choose another app. Now select the correct program and place a checkmark next to Always use this app to open .ext files, where EXT is the respective file extension.
To fix a broken LNK (shortcut) file association, you might have to apply a registry fix.
How to Identify File Types
Should you ever come across alien file types, Google or WolframAlpha might be able to tell you more about them.
You can also use the TrID to analyze a file that’s lacking a file extension. You can choose between three versions: TrID File Identifier is a command line utility, TrIDNet comes with a user interface (UI), and TrID Online is the web version. All three can read the binary signature of your mystery file and compare it to the TrID database of file types. If there is a match, you’ll know what kind of file you’re dealing with.
How to Batch Rename File Extensions
You can batch rename file extensions in two ways. You can either use the command line or you can use a third-party tool. If you want to change more than just the extension — if you’d also like to make changes to the file name, for example — using a third-party tool is recommended.
The Command Line Approach
For this approach, add all the files you’d like to edit into one folder. Hold Shift while you right-click that folder and select Open command window here.
Rename and Replace Files
If you want to rename and replace the original files, enter the following command and replace “OLD” and “NEW” with the respective extension names:
ren *.OLD *.NEW
For example, to batch rename file extension from JPEG to JPG, the command would look like this:
The * is a wildcard that allows you to apply the command to any file matching the file type criteria you’re after. You can rename only one specific file by replacing the * with the full file name.
Copy and Rename Files
If you want to keep the original files and create new files with the desired extensions, use the following command:
xcopy *.OLD *.NEW
Note that you might need to run an elevated command prompt (with administrator rights) for the xcopy command. In Windows 10, right-click the Start button and choose Command Prompt (Admin). You can manually navigate to your folder using the cd command, followed by the folder path, e.g. cd C:\Users\your_username\Downloads\Batch Rename.
The Software Approach
The command prompt seems more intimidating than it is. But if you still prefer a graphical user interface, here are is a solution for this particular task of renaming the file extension.
This tool can only do only one thing: change file extensions in bulk. As a result, the user interface (UI) is super simple.
First, choose where the tool shall search for files to match your criteria. You can include sub-directories.
Second, add extensions and what to replace them with, e.g. DAT with DOC. If you have files without extensions, you can treat those too by adding an extension to the empty line at the bottom of step 2.
Finally, press Go! and review the results.
Note that Bulk Extension Changer will rename the original files without copying them first.
Alternative tools with advanced options include Bulk Rename Utility and AdvancedRenamer. Gavin has covered these in his piece on batch operations in Windows, which covers the use of File Explorer, the Command Prompt, and PowerShell. I recommend the former if you have very complex requirements, but go with AdvancedRenamer if your needs are simpler and you prefer a clear UI.
Your File Extensions Sorted
Now you know almost everything there is to know about changing file extensions. Remember that changing the file extension won’t change the file type or format. Only a proper file conversion can convert a file from one format to another.
Which files have caused you trouble and how did you solve it? Do you have any other questions about file types, formats, or extensions? Please leave a comment!