HOWTO: Fix Default Actions for File Types in Windows

Windows Vista LogoPROBLEM: You just installed your favorite image editing application (Photoshop, GIMP, etc.) and now the default action of Preview is replace with the default action of Open, which opens the image in said image editor. While Preview is still available, it can only be accessed with a right-click menu.

REASON: The Windows registry is screwy in how it handles extensions, their descriptions, and available actions (verbs).

HKEY_CLASSES_ROOT
├─[extension]
│ ├─(Default)        [arbitrary-identifier]
│ ├─Content Type     [full-mime-type]
│ └─Perceived Type   [root-mime-type]
├─OpenWithList
│ ├─Program1
│ ├─Program2
│ └─Etc.
├─OpenWithProgids
│ ├─[arbitrary-identifier]
│ ├─[arbitrary-identifier]
│ └─Etc.
├─[arbitrary-identifier]
│ ├─(Default)         [human-readable-name]
│ ├─DefaultIcon
│ │ └─(Default)       [path-to-icon]
│ ├─shell
│ │ ├─(Default)       [action]
│ │ └─[action]
│ │    └─command
│ │      └(Default)   [command-line]

As you can see from the tree (or maybe not), the original intention was to easily accommodate programs that can handle multiple extensions. By registering multiple file extensions to a single [arbitrary-identifier], you only need one [arbitrary-identifier] to open them all. The problem is that [arbitrary-identifier] gets to define the extension AND the available actions. This often leads to things like every image becoming an Adobe Photoshop Image or every RTF (Rich Text Format) and WPD (Word Perfect Document) becoming a Microsoft Word Document.

And so no one accuses me of over-simplifying, there are other ways to add to the available list. But this involves Class IDs (and MIME types, I think) and a lot of extraneous jumping around in the registry and shouldn’t be messed with casually.

SOLUTION:

  1. Open up regedit.exe and browse HKEY_CLASSES_ROOT for each extension you want to change. HKEY_CLASSES_ROOT is the very first key, and the extensions are the first entries.
  2. Take note of each [arbitrary-identifier] in HKEY_CLASSES_ROOT\[extension]\(Default)\[arbitrary-identifier].
  3. Change HKEY_CLASSES_ROOT\[arbitrary-identifier]\shell\(Default) for each [arbitrary-identifier] to the action you wish to take by default.

EXAMPLE:

Changing the default action for .BMP files back to Preview after GIMP installation.

  1. Open up regedit.exe and browse HKEY_CLASSES_ROOT for .bmp
  2. HKEY_CLASSES_ROOT\.bmp\(Default) = GIMP-2.0-bmp
  3. Change HKEY_CLASSES_ROOT\GIMP-2.0-bmp\shell\(Default) to Preview

Note that GIMP tries to play nice and does not lump all image formats into one identifier.