I see you're writing to
HKEY_CLASSES_ROOT with that reg file in the question. This hive is a merged view of
The reason your file only works for previously unassociated files is that writes to
HKEY_CLASSES_ROOT redirect to the appropriate key in
HKEY_LOCAL_MACHINE (the hive for system defaults and all-user settings). However, you will run into a problem because file association settings in
HKEY_CURRENT_USER (which contains per-user settings) override system defaults.
Furthermore, if the extension is controlled by a "default programs" association, it's file association information is stored in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\<.ext>. You can check if your extension has this association by checking for the existence of that key.
You can edit your .reg to work for any file, including previously associated files, by duplicating it for those keys in both
HKEY_CURRENT_USER. Similarly, you can remove the association by deleting the appropriate keys in both hives (including the
A working .reg file to delete an association for a particular extension looks like this (which deletes
Windows Registry Editor Version 5.00
; Created with Default Programs Editor
; Delete Extension
However, if you'd prefer not to have to educate yourself on registry internals and the various arcane aspects of Windows file association, I'd recommend that you'd use Default Programs Editor to make these changes- you can even export an action to a .reg file, which seems to fit your needs perfectly.
In your case, it's as simple as clicking
File Type Settings, then
Delete an extension. Select the extension, and instead of saving to the registry, press the small arrow on the
Delete Extension button, and click
Save to .reg file.... This will produce a complete and commented .reg file of this action which you can save or distribute to other machines.