Windows File Association Explained for Desktop Administrators

Disclaimer: This article is rather technical and not for the novice user. If you’re looking for simple steps to manually change your file association, check out:

Windows file association remains one of the most common and frustrating challenges for any Desktop Administrator. To tackle this challenge, we’re going to take a ground up approach to demystify some of the underlying file association mechanics in a way that will allow you, the administrator, to regain control over your file associations again.

File Association in HKEY_CLASSES_ROOT (The Windows XP Way)

Within HKCR we have the file extension and the handler registry keys (2):

File Extension key for HKCR\.TIF file extension

Handler key for HKCR\.TIF file extension

The file extension key points to the handler key. In this case, the .TIF extension key points to the TIFImage.Document key as specified in the data for the Default value under the .TIF key pictured in the first image above. The TIFImage.Document key specifies the command to run to open the file. In the second image above you can see TIFImage.Document is specifying the command for Windows Photo Viewer.

There is also a second location for handler keys to be aware of located under HKCR\Applications. The HKCR\Applications key is a location where developers can register their application by creating an entry that can later be referenced as a handler for a file extension (see for more information on that). Generally, under the Applications key a subkey structure is created for a given application specifying the application’s executable path, such as this:

Handler key located under HKCR\Applications

This relationship serves as the foundation of file association dating back to Windows XP and earlier. All files have an extension key and a corresponding handler key and this is the mechanism that established basic file association. The shortcoming of this mechanism is that it sets the association for all users.

File Association in HKEY_CURRENT_USER (The Windows 7 Way)

With Windows Vista\Windows 7 we saw the introduction of the HKCU hive playing a role in file association for the first time, allowing users to select their own individual file associations. Within the HKCU hive at HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts there exists a new set of keys:

Default File Extension key for .TIF file extension under HKCU

Notice how there’s not much to this initially, simply a key specifying the file extension, a subkey called OpenWithProgids, and a value under that key specifying a handler for the file extension in question. This specification of a handler is creating a connection for that specific user between that file extension and the handler key mentioned earlier under HKCR. It should be noted that this reference in HKCU supersedes the handler specified under HKCR for a file extension for the logged-on user.

Now look what happens when an application is specified by the user (via Control Panel or Default Programs):

File Extension key under HKCU after user has specified an application to open a particular file extension

Notice that 2 additional keys are created. The most important of these 3 keys are the OpenWithProgids and UserChoice keys as they specify the file association for the currently logged on user and can be set on a per user basis to achieve user-defined file associations. When these keys are created, the UserChoice key will be created with a value called Progid and that value will contain the handler reference for the application the user specified. That handler reference creates a connection to the handler key mentioned above under HKCR and supersedes the handler reference specified under the OpenWithProgids key mentioned above. It should be noted that a Progid value of Applications\ExecutableName is referring to a handler located under HKCR\Applications.

The addition of the HKCU file association keys compliment the underlying HKCR file association and work with those keys to achieve user-specific file association on Windows 7/8/8.1/10. Many of you are saying, “these mechanisms worked great for us on Windows 7 – what’s the issue with Windows 10?”

File Association in a File (The Windows 10 Way)

Starting with Windows 8, Microsoft introduced “tamper protection” into the aforementioned HKCU registry keys to prevent unauthorized changes to file association (changes not made via the Windows API). Unfortunately, this changed how we as Desktop Environment admins approach file association. Direct registry edits to the HKCU hive are no longer viable as they simply result in an app reset notification and the HKCU keys reverting to their original state:

The new method for setting file associations across the environment is a 2 part process. First a default file association XML file must be created. To create the XML file, on a reference Windows 10 machine (built with the most recent build of Windows 10 in your environment), load the apps you need for the desired associations, create the desired file associations manually, and then export that file via a DISM command:

Dism /Online /Export-DefaultAppAssociations:\\Server\Share\AppAssoc.xml

That will yield an XML file with content that looks like this:

What this file actually does is set the HKCU\....\UserChoice key (mentioned earlier in the article) for a specified file extension to the file handler specified in the XML file:

Second, the exported file is specified in group policy, and all client machines that receive that policy will reference the file for their default file associations (for the group policy settings please see . It should be noted that the associations set in this file are enforced and file association changes made manually by the user will revert to the associations specified in the file. Therefore, this file supersedes any choice the user may have manually set because it is being applied via group policy during each user login. For detailed information on creating this file please see

In Closing…

Based on everything we’ve covered, a quick overview of the file association precedence hierarchy looks like this:

In Windows 10, the XML file is necessary for enterprise administration as it’s a mechanism we can expect Microsoft to build upon. Therefore understanding the relationship between the various part of the registry and the XML file, we can understand how file association can break, and where we can manipulate the keys (*cough* in HKCR *cough*) to get the desired results. I hope this helps someone and thanks for reading!

Excellent article and very insightful!

Discussion Info

Last updated October 22, 2020 Views 7,911 Applies to: