Change Default Apps, Browser or File Association via Command-line in Windows 10

In Windows 10, setting per-user file associations for a logged on user account has to be done only using Default Apps or the Open with dialog manually. If you try to change the user default registry entries using script or batch files, Windows 10 will reset the file association to Windows defaults, and you’ll see the annoying An App Default was Reset notification.

Set Default Browser and File Associations via Command-line

Microsoft says applications must not write to the UserChoice registry key which stores the user-default association settings. This is because the user must be in control, not the programs. Programs competing with each other and arbitrarily changing the user-specific associations is not going to be good user experience. The UserChoice key is a protected location, and the ProgID value is validated with a hash.

Set Default Browser and File Associations via Command-line

When you use Default Apps or Open with to set associations, Windows 10 generates the hash for each file type association. The hash generated is based on many inputs like user account SID, ProgId, registry time, etc., and perhaps other parameters.

Default Browser & File Association via Command-line in Windows 10

Users may sometimes need a shortcut method to set file associations for their user account without going through the Open with dialog or Default Apps every time. Some toggle switch or shortcut to change browser or file association defaults will be a great help for users.

Luckily, we have the SetuserFTA tool to do that. To set the file association and default browser via command-line, use the SetuserFTA utility written by Christoph Kolbicz. Kolbicz has reverse-engineered the hashing algorithm effectively. This utility generates the hash automatically and sets the defaults for you.

Set Default Browser and File Associations via Command-line

To change the default browser using command-line, use this syntax:

SetUserFTA.exe extension progid

It also supports URL protocols (e.g., http, https, mailto, etc.)

Google Chrome

To set Chrome as the default browser, run these commands:

SetuserFTA  http ChromeHTML
SetuserFTA  https ChromeHTML
SetuserFTA  .htm ChromeHTML
SetuserFTA  .html ChromeHTML


SetuserFTA  http FirefoxHTML
SetuserFTA  https FirefoxHTML
SetuserFTA  .htm FirefoxHTML
SetuserFTA  .html FirefoxHTML


SetuserFTA  http OperaStable
SetuserFTA  htts OperaStable
SetuserFTA  .htm OperaStable
SetuserFTA  .html OperaStable

Microsoft Edge

SetuserFTA http AppXq0fevzme2pys62n3e0fbqa7peapykr8v
SetuserFTA https AppX90nv6nhay5n6a98fnetv7tpk64pp35es
SetuserFTA microsoft-edge AppX7rm9drdg8sk7vqndwj3sdjw11x96jc0y
SetuserFTA .htm AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9
SetuserFTA .html AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9

RELATED: See article How to Remove File Type Associations Using the Registry Editor for more information on File extension → ProgID mapping.

Default Image Viewer

To set Windows Photo Viewer as the default handler for .png and .jpg files, run:

SetuserFTA  .jpg  PhotoViewer.FileAssoc.Jpeg
SetuserFTA  .png  PhotoViewer.FileAssoc.Png

Note that you’ll have applied the Windows Photo Viewer registry edit as in the article Restore Missing Windows Photo Viewer in Windows 10 for the above commands to work. Without the necessary ProgId registration, your files will show up as unknown file type.

To revert to Microsoft Photos as the default, use this command-line:

SetuserFTA .jpg AppX43hnxtbyyps62jhe9sqpdzxn1790zetc
SetuserFTA .png AppX43hnxtbyyps62jhe9sqpdzxn1790zetc

ProgID vs “Applications\program.exe”

If an application doesn’t define a file class or Progid, you can mention the program’s exe as well, like Applications\program.exe type as well. This works if the program is registered under HKCR\Applications registry key.

For example, to set Notepad++ as the default editor for .txt files, run:

setuserfta .txt applications\notepad++.exe

To revert to default (notepad.exe), use:

setuserfta .txt txtfile
setuserfta .txt applications\notepad.exe

You may create desktop shortcuts for the required commands to switch defaults quickly in a single click!

View current user defaults for all file types

To get the user defaults for all file types and URL protocols, run the command:

SetuserFTA  get

Set Default Browser and File Associations via Command-line

SetuserFTA makes the job of setting file associations easy.

Note: There is a similar utility from which I’ve not tested yet. If you want to check it out, visit Set File Type Association Default Application Command Line Windows 10 UserChoice Hash Internal Method

One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

6 thoughts on “Change Default Apps, Browser or File Association via Command-line in Windows 10”

  1. I’m just a user, not a geek techie! All this crap is meaningless to almost all of us. I’ll have
    to hire some body in order to be able to use a $1200 computer!

  2. The program doesn’t appear to work, or the instructions don’t cover the most common cases. For example, how do I assign .jpg files to be opened by “C:\Program Files (x86)\IrfanView\i_view32.exe”?

    None of the following work, but none of them display any error message!
    setuserfta jpg “C:\Program Files (x86)\IrfanView\i_view32.exe”
    setuserfta .jpg “C:\Program Files (x86)\IrfanView\i_view32.exe”
    setuserfta .jpg i_view32.exe
    setuserfta .jpg application\i_view32.exe

    The following gives an error message:
    setuserfta .jpg application\”C:\Program Files (x86)\IrfanView\i_view32.exe”

    • @cdg: Try:
      SetUserFTA.exe .jpg applications\i_view32.exe
      SetUserFTA.exe .jpg applications\mspaint.exe

      It’s “Applications” (not “Application”)

  3. I’ve ben attempting to work with Microsoft Tech Support under my paid support subscription and so far no one at the Tier 1 or 2 level acknowledges that the chose default application Graphical User Interface (GUI) and Open with functionality is flawed. The above article’s mention that MS protects the file extension associations with a hash is enlightening. I suppose this is block malicious code from making changes…? I have to laugh that .pub files which are generated my Microsoft Publisher, and .msg files are not automatically recognized by the OS and associated with those applications. What’s more when I try to associate them the OS doesn’t present those applications as choices.

  4. Think this is getting into AntiTrust areas with MS forcing only its view of valid apps being allowed to be associated.
    Back to the days of bottling up IE to Windows and Governments bringing MS into court.

  5. Unfortunately in most enterprise environments (where this is most useful), we are not able to download 3rd party unapproved apps.


Leave a Comment