Windows 11: Programmatically change default apps/file associations

I can’t find a method to programmatically change default/associations for file extensions (e.g. .mp4 open with VLC) or protcols (e.g. https open with Firefox) on existing user accounts. I can’t find anything that works other than manually going into Settings → Apps → Default apps and changing each extension and protocol by hand. This is a drag, especially given the number of systems we’re likely to be moving from W10 to W11 this year.

It looks like most of the registry keys that have historically helped with this have a “Hash” key to resist tampering that varies between users [Ref]. Similarly, cmd.exe commands assoc and ftype don’t seem to take effect even after a reboot.

What options do I have for automating this process on Windows 11 Home and Pro editions? I would strongly prefer not to use closed source 3rd party tools like SetUserFTA.exe.

This is what you want: DISM Default Application Association Servicing Command-Line Options | Microsoft Learn

Don’t know if it works with Home, but it works with Pro. Here’s the XML I use to associate PDFs to Adobe Reader and mailto:// to Outlook classic:

<?xml version="1.0" encoding="UTF-8"?>
<DefaultAssociations>
  <Association Identifier=".pdf" ProgId="AcroExch.Document.DC" ApplicationName="Adobe Acrobat Reader DC" />
  <Association Identifier="mailto" ProgId="Outlook.URL.mailto.15" ApplicationName="Outlook 2016" />
</DefaultAssociations>
1 Like

Thank you, but that only works for new accounts doesn’t it? I’m hoping for something that can be run repeatedly on existing accounts to maintain the desired associations.

Fortunately, a friend found a couple powershell scripts by axpokl and default-username-was-already-taken that didn’t work for me individually on W11, but I’ve combined them in a fork of default-username-was-already-taken’s script. With the code borrowed from axpokl, the fork works as advertised for me in W11 en-US 22H2 and 24H2. It doesn’t work for protocol defaults yet (e.g. http), but I plan to take a swing at that later.

1 Like

DISM /Online should modify the local host (i.e. affect your computer and user, in theory).

But it seems that you already solved your problems!