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 theRegistered 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:
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 ofHKCU\Software\Classes
for user-specific associations andHKLM\Software\Classes
for system-level associations), I would have just gone through the.ext
entries, and looked up theirFileType
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 myHK**\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\
- I recently learned
HKCR
had actually been obsoleted a decade ago (I forget if it was Win95 or WinXP)
https://social.msdn.microsoft.com/Forums/vstudio/en-US/630ed1d9-73f1-4cc0-bc84-04f29cffc13b/what-registry-keys-are-responsible-for-file-extension-association?forum=netfxbcl
- I recently learned
-
File Extension:
HKCU\Software\Classes\.ext\
(Default)
=NameOfAssociation
(ie,PerlScript
ortxtfile
, 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)
= PathToIconShell\
(Default)
=nameOfVerb
(sets the default verb to run for double-click)nameOfVerb\
(Default)
= Human Readable Verbcommand\(Default)
=path\to\exe "%1" %*
- make it
REG_EXPAND_SZ
if you want path to include%EnvironmentVariables%
- make it
-
RClick > “Open With” > Use as Default end up here:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
- reference: https://stackoverflow.com/a/3924822/5508606
- If you want to go back to the system default, delete
...\FileExts\.ext\UserChoice
-
-
@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.