Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Windows 10 / Changing Default File Associations in Windows 10 and 11

February 27, 2023 Group PoliciesWindows 10Windows 11Windows Server 2019

Changing Default File Associations in Windows 10 and 11

In this article, we’ll look at how to manage the default File Type Associations (FTA) on Windows 10/11 and Windows Server 2022/2019/2016. As an example, we will show how to assign a default program to open *.PDF files in Windows, export these settings into an XML configuration file, and deploy the resulting file with file association settings to other computers manually or using Group Policy (GPO).

The main difference between Windows 10/11 and previous Windows versions is that you can’t manage file association settings through the Registry or the “Open With” feature of the Group Policy Preferences. However, there is a new opportunity to export the current settings of file associations from the “reference” computer to an XML file and apply this file to other computers. You can also import a file associations file into a Windows image deployed on your computers (manually, via WDS or SCCM).

Contents:
  • How to Change Default Program to Open a File Type on Windows 10 and 11?
  • How to Set File Assertions from the Command Prompt?
  • Export and Import Default App Associations on Windows to the XML file
  • Configure Default File Associations with Group Policy
  • Changing File Association via the Windows Registry
  • How to Reset All File Associations to Default in Windows 10 and 11?

How to Change Default Program to Open a File Type on Windows 10 and 11?

Let’s say you want to use Adobe Reader DC to open *.PDF files on your computer. This means you need to associate this file extension with the application. In this example, I’m using a reference computer with Windows 10 22H1 and Acrobat Reader DC installed.

Note that Windows 10 and 11 now have the Microsoft Edge browser installed by default as the default PDF viewer.

To manually create a mapping between a file extension and a program, go to the Settings -> Default Apps (or run the Settings URI command -> ms-settings:defaultapps) and click the Choose default apps by file type button.

set deafult apps on windows 10

Find the .PDF file type in the list of extensions. Then click on the icon of the program associated with this extension and change the default PDF viewer from Microsoft Edge to Acrobat Reader.

choose default app for file extension in windows 10 settings

You can automatically assign a specific app with the file extension for which it is registered. To do this, select Set default by apps in the Default Apps section, find your program in the list and click the Manage button.

set default app in windows

The next screen contains a list of file types supported by the application. Select the file extensions you want to open with Acrobat Reader.

configure file type protocol assotiation in windows

How to Set File Assertions from the Command Prompt?

On Windows, you can use the assoc command line tool to configure file associations for applications. For example, to check the program that should be used to open PDF files, run the command:

assoc .pdf

In this example, you can see that the AcroExch.Document.DC file type is associated with the PDF file extension:

.pdf=AcroExch.Document.DC

assoc command in windows

Show all extension associations with file types:

assoc|more

To understand which program the AcroExch.Document.DC file type is associated with:

ftype AcroExch.Document.DC

ftype command to set file to app assotiations

You can set the type for a specific file type with the command:

ASSOC .csv=txtfile

In this example, we have specified that all CSV files should be opened as plain text files (using notepad.exe by default).

You can create or change the association of a file extension with a program from the command prompt. For example, you want all files with the .tx1 extension to open with notepad++.exe. First, you need to associate the .tx1 extension with the new tx1file file type.

assoc .tx1=tx1file

Now let’s specify the program that should be used by default to open files with the tx1 extension.

ftype tx1file="%programfiles(x86)%\"Notepad++\notepad++.exe" "%1"

You can also use the third-party SetUserFTA tool to assign file associations in Windows. SetUserFTA is a command line utility for quickly setting up file associations (often used on Windows Server 2019/2022 RDS farms to configure file associations with apps).

You can list the current file associations and the ProgID set for them in Windows like this:

SetUserFTA get

setuserfta tool to manage file assotiations

To set an association for a specific file extension, use the command:

SetUserFTA.exe extension progid

For example, set Chrome as the default browser for HTML files:

SetUserFTA .http ChromeHTML
SetUserFTA .https ChromeHTML
SetUserFTA .htm ChromeHTML
SetUserFTA .html ChromeHTML

If the application doesn’t have a registered file class or Progid, you can specify its executable. For example:

SetUserFTA .txt applications\notepad++.exe

This is possible for apps registered in the registry key HKEY_CLASSES_ROOT\Applications.

Export and Import Default App Associations on Windows to the XML file

The current file association settings for programs configured under the current user can be exported to an .XML file using DISM:

Dism.exe /online /Export-DefaultAppAssociations:C:\PS\DefaultAssoc.xml

The command exports to an XML file all of your configured program associations. You can open the DefaultAssoc.xml file with any text editor, and see the full list of file associations exported. If you need to use only a part of associations from this list (in order not to override the existing user associations), you can manually edit the XML file. Leave only the lines with the file extensions you need. For example, we’ll leave the following lines for PDF and FDF extensions:

<?xml version="1.0" encoding="UTF-8"?>
<DefaultAssociations>
<Association Identifier=".fdf" ProgId="AcroExch.FDFDoc" ApplicationName="Adobe Acrobat Reader DC" />
<Association Identifier=".pdf" ProgId="AcroExch.Document.DC" ApplicationName="Adobe Acrobat Reader DC" />
</DefaultAssociations>

dism: export default app assotiations
The resulting XML file can be imported into a Windows on other computers using the DISM tool:

Dism.exe /Online /Import-DefaultAppAssociations:C:\PS\DefaultAssoc.xml

Important. These settings to map file extensions to apps will be applied only to new user profiles during at first logon. If you receive an App default reset notification error during the import, check the syntax of the XML file.

You can also import association settings to an offline Windows image in a WIM file (which you use to deploy Windows to new computers).  First, you have to mount the image:

Dism /Mount-Image /ImageFile:C:\mnt\images\install.wim /MountDir:C:\mnt\offline

Then import the XML file:

Dism.exe /Image:C:\mnt\offline /Import-DefaultAppAssociations:\\Server1\Share\DefaultAssoc.xml

Tip. The current file association settings in an offline Windows image can be obtained using this command:

Dism.exe /Image:C:\mnt\offline /Get-DefaultAppAssociations

Configure Default File Associations with Group Policy

In modern versions of Windows, you can use a Group Policy (GPO) option that allows you to apply an XML file with file association settings to all current users of a computer.

For example, you want to apply a group policy with file association settings to all computers in a specific OU (Organizational Unit) of Active Directory.

  1. Open the Group Policy Management console (gpmc.msc );
  2. Find the OU with computers for which you want to apply file associations and create a new GPO;
  3. Switch to GPO editing mode and go to the section Computer Configuration -> Administrative Templates -> Windows Components -> File Explorer;
  4. Find the option Set a default associations configuration file;
  5. Enable the policy and specify the UNC path to your XML file (make sure the path doesn’t contain quotes or spaces) It can be located on a shared network folder, SYSVOL directory on the domain controller, or pre-copied to the computers using GPP or SCCM;gpo: apply default assotiations config xml file
  6. Restart your computer to apply the new file associations.
    You can use the gpresult.exe tool to troubleshoot GPO problems.

The new file association settings will be applied to all users of the computer the next time they sign in.

The path to the XML file with the new file association settings is contained in the DefaultAssociationsConfiguration registry parameter under the key HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\System.DefaultAssociationsConfiguration registry parameter

Since Windows 10 tracks changes in the file association settings, the first time you try to open a PDF file, a window may appear confirming the use of Acrobat Reader to open this file type (the prompt appears only once). Such a request will always appear after installing a new application that is registered to open an existing file type or protocol. You can hide these notifications by enabling the policy “Do not show the ‘new application installed’ notification” under the same GPO section.

When working in Windows, a user can reassign these file associations. However, the next time the Group Policy settings are updated at the next logon, the user’s file associations will be overwritten with the settings from the XML file.

Changing File Association via the Windows Registry

As we said above, in Windows 10 /11the way to set file association options has changed. In the previous section, we showed you how to configure the association for the .pdf  file type with an Acrobat Reader through an XML file and Group Policy. Now let’s see how it looks in the Windows registry.

Run the Registry Editor (regedit.exe) and go to the registry key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ Explorer\FileExts\.pdf\UserChoice. This registry key contains the association settings for the PDF file extension.

Please note the following registry parameters:

  • ProgId – this is the identifier of the registered app to open this file type. This app ID is specified in the XML file. If a long identifier is specified instead of the application name, then the file association with the modern UWP (Metro-style) application is configured. Make sure this UWP app has not been removed from the Windows image;
  • Hash – a hash value that is automatically generated to validate the file association with the program. The presence of this hash ensures that the user or administrator (via the GPO) has configured this file mapping. This security mechanism is needed to protect users from malware that can change file associations without the user’s approval.

registry: fileexts userchoice assotiations

If you try to manually change the ProgId registry value and assign another program, the Hash value will no longer be valid. In this case, Windows will automatically reset the file association settings to the default state and the user will see a notification:

An app default was reset.
An app caused a problem with the default app setting for .html files, so it was reset to Microsoft Edge.

windows 10 notification: An app default was reset

Accordingly, in Windows 10/11 and Windows Server 2022/2019/2016 you won’t be able to configure file associations through the registry, as it worked in Windows 7 and Windows Server 2008R2.

There is a third-party SetUserFTA.exe tool (mentioned earlier) that allows you to calculate the hash and assign a file extension to a program directly through the registry.

How to Reset All File Associations to Default in Windows 10 and 11?

You can reset the previously imported file association settings using the command:

Dism.exe /Online /Remove-DefaultAppAssociations

After running this command, all new users will be logged in with the default file association settings (the reset has no effect on the existing user profiles).

In order to reset the file associations configured manually by the user to the default ones, you need to click on the Reset button in Settings -> Apps -> Default Applications.

reset file assotiation to defaults on windows 10

This will revert all file associations to a clean Windows 10 state.

16 comments
5
Facebook Twitter Google + Pinterest
previous post
Using iPerf to Test Network Speed and Bandwidth
next post
Configuring Remote Desktop Services (RDS) Farm on Windows Server

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Installing Language Pack in Windows 10/11 with PowerShell

September 15, 2023

How to View and Change BIOS (UEFI) Settings...

September 13, 2023

16 comments

SCOTTY February 4, 2021 - 9:22 am

Wow…Microsoft sure knows how to SCREW things up!
If they would just keep things simple then they would have a much faster OS…
There is no need whatsoever for File Associations so they just need to get rid of it altogether…
If an application knows how to open up a file then let it do so…if it FAILS then let that application FAIL.
Same thing goes for Browsers…Get rid of DEFAULT BROWSERS…
Let the User of the Computer decide what Browser they want to use.
There is no need whatsoever to be asking the User what App they want to open WHAT FILE…
Garbage…
Get rid of the whole File Associations thing and watch how much faster the OS will be.
Just saying.
– SCOTTY

Reply
Paula April 7, 2022 - 10:42 am

Huh? How can this possibly work:
1. Remove all file associations… and all default browser settings.
2. All the files will somehow just “magically” know which programs to use, when opening a file.
3. Let the computer decide.

How can the hardware (computer) decide?
The File Associations are what *MAKES* things work.

Reply
Gustaaf February 8, 2021 - 11:42 am

Beam that comment down Scotty!
File associations have been around since MS-DOS days. It is how the MS operating systems have grown over time to make use of these human discernable understanding of an OS, even Linux world has a few. like .RPM etc.

How does the OS know that a file/program belongs to Scotty vs Gustaaf? It’s last name of course! Extensions and default handlers fill in that gap like a last name. And you missed the part where the author explained that extension handling is now a security concern too, where we would want to prevent unauthorized changes!

Reply
Mike Hathaway March 17, 2021 - 8:50 pm

Scotty is right, this is insanely stupid. There should be a GPO not a link to an XML file somewhere for setting the default for application. This is Microsoft allowing you to do something but making it extremely difficult and add a performance penalty. A default browser is an option in Windows, with no equivalent GPO there is only one reason to do that, make IE or whatever other br4owser MS creates the hardest possible default to change.

Reply
sysadmin July 22, 2021 - 5:34 pm

No, Scotty is VERY wrong and isn’t thinking any of these suggestions through. It’s a recipe for a poor user experience, and the idea of having no default handlers is a security nightmare and an attacker’s wet dream. And there is no performance penalty to default file types either. Also, you have to have at least one default browser on the system. How else could you download another?

As for why there is no GPO ability, again think it through. Back in the XP/Vista/7 days any program could install and usurp your default applications with little effort. MS made changes that made it more difficult (which is good, especially today) for applications to change default file types without your knowledge. If a GPO was available (i.e. just making registry changes), that would effectively create a loophole bringing this problem back into existence.

And none of this is “extremely difficult”, nor does it cause a performance penalty.

Reply
Alexandru Chirita October 12, 2021 - 9:01 am

I agree with you but there is a way to make registry changes to associate a program with an extension.

For example for “.txt” extension the Registry Editor path is:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice
and you can add or edit the key “ProgId” (type REG_SZ) and you can add a custom value like “Applications\Code.exe” for using Visual Studio Code (if it’s installed) instead of Notepad.

You can also change the program list for extension “.txt” in Registry Editor path:
Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\OpenWithList
(where you have a list of type “REG_SZ” with names like “a”, “b”, “c”, and so on, and values like “NOTEPAD.EXE”, “Code.exe”, “chrome.exe” and so on).

Reply
Ferengi May 25, 2022 - 7:39 am

But the whole system is stupid now. I need a more finegrained system than this. I have hundreds of machines, laptops and desktops, with different associations everywhere. I want to change 1 association, for that I would have to “export all the things” and apply them again? What a drag.

Paula April 7, 2022 - 10:43 am

> How does the OS know that a file/program belongs to Scotty vs Gustaaf?

File associates have NOTHING to do with “what person does this file belong to”. Ugh.

Reply
Petr February 22, 2021 - 10:26 am

Thank you for great summary and details of the FTA topic (FTA global configuration is nighmare in terminal server environment for all the time, regardles of old or new method).
I have an additional question related to usgin .xml in GPO.
Do you know whether it is neccessary to allways export/import entire FTA .xml file or it is enought to apply just part of FTAs realeted to my interrest – rest of already configurad FTAs will not be changed/reset?

Reply
Nick E. February 26, 2021 - 5:53 am

In the GPO example, you seem to the Local group Policy editor opened, not the Group Policy Management of a DC. Do you recommand changing the GPO settings on the server it self? I have a DC GPO applied to the server and it works but if the user changes the association, at next logon, it’s not changed again.

Reply
Max June 23, 2022 - 3:33 pm

The GPO doesn’t work. The policy is applied correctly and successfully, the registry settings in both HKLM and HKCU have changed correctly… i.e. with correct ProgID in UserChoice… The XML file is correct. Yet, when clicking on a file it still insists “What application do you want to open this file with?”… Logged off/on numerous times too. Having spent hours on this supposedly easy and common task, all I can say is…”Microsoft, I am so frustrated with you”

Reply
Max June 23, 2022 - 3:53 pm

Found the answer to my above problem, the ProgID in XML file was set to “Application\chrome.exe” when I changed it to “ChromeHTML” everything started to work! May be this will help someone out there having the same problem..

Reply
Hagianer November 10, 2022 - 8:58 am

Tank you woshub for the detailed information.

To Microsoft:
Windows 11 22H2 Bug: The file assoziation with an exported .xml file and import with GPO is not working any more. With 11 21H2 all assoziations worked. Thank you Microsoft for an overloaded bloaded bug operating system! And thank you for doing as much that Admins cannot personalize the operation system for all Users, paternalism. Conclusion: No more Windows 11!

Reply
Andyman May 2, 2023 - 6:18 am

To Microsoft: Windows 11 22H2 Bug: The file assoziation with an exported .xml file and import with GPO is not working any more. With 11 21H2 all assoziations worked.

-Same problem with our new Windows 11 image…. No solution found.

Reply
Nik May 25, 2023 - 9:40 am

See my solution below (SetUserFTA with a config file). It’s not ideal, but at least it works 🤷‍♂️

Reply
Nik May 25, 2023 - 9:39 am

This is a great article, but in my case nothing worked for a home Windows 10 installation:
– some Windows update triggered resetting all file associations after restart in May 2023 (uninstalling recent updates didn’t help)
– setting associations manually through Settings – Default Apps didn’t work either, everything continued to reset to the default Windows apps (browser, video player, audio player, image viewer)
– I found an app StopResettingMyApps, blocked default Windows apps with it, but it didn’t help – apps just reset to a blank value
– I tried generating an .xml file with Dism.exe and added it to the Local Group Policy Editor – File Explorer, but apps still reset after restart

And then finally I went to SetUserFTA tool’s website and read that it supports configs as well. Exported my config after setting all the file associations manually, created a shortcut and added it to the startup with that config parameter – and DONE. Stupid Windows continues to reset my apps after each restart, but SetUserFTA quickly sets them back. I know it’s not the best solution, but I can’t bother to investigate this problem more. Thank you, WOShub, for mentioning this great tool.

Reply

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Updating List of Trusted Root Certificates in Windows
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Configure Google Chrome Settings with Group Policy
  • How to Delete Old User Profiles in Windows
  • Allow Non-admin Users RDP Access to Windows Server
  • How to Backup and Copy Local Group Policy Settings to Another Computer
  • How to Find the Source of Account Lockouts in Active Directory
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top