Windows has always been able to associate a file extension with an application. This means that when a user double...
clicks on a file, Windows automatically loads the application associated with that file and then uses the application to open it. Sometimes, however, an application hijacks file extensions from other apps.
For example, I have a thermal imaging camera that records videos in .ASF format, and Windows won't play the video correctly unless I change the file extension to .ASX. Instead of changing the file extension for every video I record, I simply acquired a video player that natively supports .ASF files. But this new video player hijacked file extensions registered to other applications. For example, .MOV files now open in my new video player instead of in QuickTime.
Luckily, it's relatively easy to associate file extensions in Windows.
One way to do this is to launch the Default Programs applet -- select the Default Programs command from the Start menu -- and then click Associate a File Type or a Protocol with a Specific Program. In this dialog box, as shown in Figure 1, Windows lists every file extension it knows about as well as the application associated with each extension.
To reset the association for an extension, select the one you want to change, and click Change Program. Windows will display a list of applications known to support the file extension. If the application you want to use is listed, simply select it and click OK.
However, there is a chance that the application you want to associate with a file extension will not be listed. If this happens, you can browse for an application. To do so, click Browse, and then navigate through the file system until you locate the executable file for the application you want. Once you locate the desired application, select it and click OK twice.
Unfortunately, I don't know of a safe and easy solution to this problem. While you can look up file associations with PowerShell, the technology doesn't support modifications. Therefore, your only option for making large-scale modifications is to work directly with the registry, and -- as I'm sure you know -- editing the registry is dangerous. One mistake can destroy Windows and/or your applications. As such, always back up a machine before attempting a registry modification.
Information related to file associations can be scattered throughout the registry, and since different applications can register file extensions in different ways, there isn't just one registry hive that can be modified in every situation to reclaim a file extension.
Therefore, you have to first determine which registry keys are affected by the file-extension modification. To do so, open the Registry Editor. Click on the Computer node at the top of the registry tree, and choose Export from the shortcut window. This allows you to export the entire registry to a text file with a .REG extension.
Next, you must reclaim your file extension. If you want to reclaim every file extension that has been hijacked, the easiest way is to reinstall the application that should be associated with the file extensions. This will usually re-associate the hijacked extensions with the correct application. If that doesn't work -- or if you only want to reclaim some of the extensions -- then you have to use the manual method described earlier.
When you are done, export the registry (in the same way as above), and you should now have two separate registry files. Be sure to keep track of which is which. Use the Diff tool that comes with Visual Studio to compare the two registry files. The command will look something like this:
Diff –u5 before.reg after.reg
This command assumes that the registry files are named Before.Reg and After.Reg. The command's output should show all of the differences between the two registry files, and assuming that you haven't made any other changes to the PC, the differences should be directly related to the file extensions.
Next, navigate through the Registry Editor to each location referenced in the Diff output, right-click on the individual registry key, and export it to a .REG file. Now, you can import the .REG files into the computers on your network (don't import the Before.Reg or After.reg files) to fix the file association problems.
Manually fixing file-extension problems can be a lot of work. Sometimes it may be safer and easier to redeploy the application that should be associated with the hijacked extensions. But if that doesn't work, you may have no choice but to use the manual approach.
ABOUT THE AUTHOR
Brien M. Posey, MCSE, has received Microsoft's Most Valuable Professional Award seven times for his work with Windows Server, IIS and Exchange Server. He has served as CIO for a nationwide chain of hospitals and health care facilities and was once a network administrator for Fort Knox. You can visit his personal website at www.brienposey.com.