File Association gave me more than I bargained for



  • So in my job there are two new types of text files that I deal with often; with two corresponding extensions.

    I’m not typically one to do this (certainly have NOT done it for .txt files or any other) but I ran Notepad++ in Administrator mode, went to the File Associations area in the Preferences and "customize"d my two extensions so that they appeared in the Registered extensions box.

    I restarted Notepad++ in non-admin mode and went back to look at my registered extensions and I was surprised to see 10 extensions there, of which my 2 were indeed present. But what gives with the extra (and unwanted) 8 ?



  • Well, if I run as Administrator again, go back in and look, only the 2 new extensions that I wanted are listed in “registered extensions”.

    Maybe I have some misunderstanding of this feature, but I thought you had to run in Admin mode to configure this. Perhaps not.

    It still doesn’t seem to explain why, for my non-Admin mode running of Notepad++, that I went from 0 registered extensions, to 10…



  • Back in non-Admin mode, I attempted to remove the undesired 8 extensions from the “Registered extensions”. They appeared to be removed just fine but on my next restart of Notepad++ I checked and they were back again.

    So I’m flummoxed as to what to do next.

    AND…I’d really like to know the proper way of doing what I tried and failed to do (simply add two extensions as “registered”).



  • Of course now I realize (you can tell I don’t do – and don’t want to do – this kind of thing often…) that simply staying “outside” of Notepad++ and doing the following was probably the better idea, answering properly to this after double-clicking a new extension type:

    d28fa1cb-7cc1-46ba-8648-959fc461e7d0-image.png

    But of course now I realize I really don’t want these file associations at all, and I’m wondering the best way to undo the weird changes done to my registry from what I attempted inside of Notepad++.



  • @Alan-Kilborn said in File Association gave me more than I bargained for:

    I’m wondering the best way to undo the weird changes done to my registry

    If you had used a registry-watcher utility to see exactly what changes Notepad++ made, it would be easy.

    In the “good old days” of Windows, where they always used HKCR (or, technically, it’s been using that as an alias to the appropriate sections of HKCU\Software\Classes for user-specific associations and HKLM\Software\Classes for system-level associations), I would have just gone through the .ext entries, and looked up their FileType entries, and modified or deleted those shell commands. However, the “always use this app to open” settings in modern Windows will sometimes use different or convoluted registry entries, and I don’t always know where to look for those. That’s why when I am playing with associations, I prefer to just use the registry directly, and avoid both in-app and windows-gui association manipulations. Unfortunately, MS is fighting harder against that, and I’ve started to see sometimes where MS resets the app that gets used, even though my HK**\Software\Classes settings have remained unchanged; I’m still trying to figure out exactly how MS does the modern “default app” settings.

    Or, the TL;DR version: good luck with that. :-)



  • I had a flash, and found my document where I’ve taken notes on such things. I’ll post the relevant section in case it’s helpful:

    File Associations

    • User: HKCU\Software\Classes

    • System: HKLM\Software\Classes

    • Old Way: HKCR\

    • File Extension: HKCU\Software\Classes\.ext\

      • (Default) = NameOfAssociation (ie, PerlScript or txtfile, etc)
      • PerceivedType = text (or similar)
      • ShellNew\
        • see Customized Context Menu (not included)
    • Association: HKCU\Software\Classes\NameOfAssociation

      • (Default) = Text Version of Name of Association (shown in Explorer)
      • DefaultIcon\(DEFAULT) = PathToIcon
      • Shell\
        • (Default) = nameOfVerb (sets the default verb to run for double-click)
        • nameOfVerb\
          • (Default) = Human Readable Verb
          • command\(Default) = path\to\exe "%1" %*
            • make it REG_EXPAND_SZ if you want path to include %EnvironmentVariables%
    • RClick > “Open With” > Use as Default end up here: HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\



  • @Alan-Kilborn ,
    does not help to explain but I am pretty sure I saw once an issue
    reporting such behavior and as far as I remember it was due to ignoring
    errors within registry source code but I can’t find it anymore.
    As far as I remember it had something to do with this method.



  • @Alan-Kilborn
    found some discussion from the community.
    I still haven’t found the problem, maybe it was the linked post
    I mistakenly thought was reported as a problem.


Log in to reply