Monday, April 10, 2017

Windows surprise: assoc utility doesn't look at per-user settings

Today I was investigating how file associations work, and I discovered an interesting product of the interaction between the assoc utility and the HKEY_CLASSES_ROOT view. HKCR is actually a merged view onto two different Registry branches, one per-user and one that applies to the machine. User settings take precedence. Explorer looks at HKCR (including per-user settings) to get the current file associations, but the assoc utility seems to operate only on the machine section.

Therefore, it's entirely possible to see a different result on the command line than is actually in effect. On my laptop, the utility says that the association for .html files is htmlfile, but for programs running as me, the association is ChromeHTML. (Note that there isn't a direct mapping of extensions to handlers; the extension is associated with a file type, which sets the handling command line.)

No comments:

Post a Comment