SharpAffair
SharpAffair

Reputation: 5478

How to remove file associations

I'd like to know what information should be deleted in order to remove program association with particular file extension.

I obviously know that extensions are stored in HKEY_CLASSES_ROOT key, but I'm not sure what to delete or keep. Should I remove the entire .EXTENSION key when the program is uninstalled? Should I backup the original data of the key? Or simply clear the default key value (which is the program ID)?

Please advise.

Upvotes: 1

Views: 1338

Answers (1)

ewall
ewall

Reputation: 28100

First off, rather than editing HKCR directly, I would recommend you use the built-in ftype and assoc commands. (Even if they change how the Reigstry is arranged, no doubt Microsoft will continue to support these commands doing it the right way.)

I guess what you do with the file association kind of depends on how command the extension is... (You can look up common file extensions here.) If your app uses a rare file extension, then I would say you're safe to remove both the extension association (assoc .ext=) and file type (ftype myfiletype=).

But if your app registers a common file extension--say, '.TXT'--then you ought to do your best to handle it gracefully. If you wanted to be really nice, you could save the existing file associations during the install, and then restore them to those original values during the uninstall. Or in cases like '.TXT' where there's a common default (NOTEPAD.EXE), you could set it back to that. Otherwise, I might just remove the association (assoc .ext=) so the next time the user double-clicks on the file it prompts them to pick a program (which will build the ftype values for them).

Upvotes: 1

Related Questions