Summary: This post explains how to change the default apps or file associations using the command-line in Windows 10. This can be accomplished by a command-line tool named SetUserFTA.
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; you’ll see the annoying An app default was reset notification.
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 will not be a good user experience. The UserChoice
key is a protected location, and the ProgID value is validated with a hash.
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.
Users may sometimes need a shortcut method to set file associations for their 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.
Fortunately, we have the SetUserFTA tool to do that.
(Last tested with SetUserFTA version 1.7.1 on Windows 10 v21H1 on May 21, 2021. Works perfectly.)
Set Default Apps, Browser, or Associations via Command-line
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.
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
Firefox
SetUserFTA http FirefoxHTML SetUserFTA https FirefoxHTML SetUserFTA .htm FirefoxHTML SetUserFTA .html FirefoxHTML
Opera
SetUserFTA http OperaStable SetUserFTA htts OperaStable SetUserFTA .htm OperaStable SetUserFTA .html OperaStable
Microsoft Edge (Chromium)
SetUserFTA http MSEdgeHTM SetUserFTA https MSEdgeHTM SetUserFTA microsoft-edge MSEdgeHTM SetUserFTA .htm MSEdgeHTM SetUserFTA .html MSEdgeHTM
Microsoft Edge (legacy)
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 an 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 or 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
SetUserFTA makes the job of setting file associations easy! There is a similar utility from Danysys.com, 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!
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!
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”)
Hello:
IrfanView is amongst the *friendliest* apps ever made! It provides a very simple and selectable method for setting all associations very easily and quickly. I have never had any problems with it, as long as it has been in existence and that is UNIQUE!
https://www.irfanview.com/faq.htm
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.
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.
Unfortunately in most enterprise environments (where this is most useful), we are not able to download 3rd party unapproved apps.
Hey thanks for this article its great
One issue though: I setup 3 batch files to switch between Chrome, Edge and Firefox.
The first 2 work perfectly using the instructions as above.
i.e. if I click on a link in an email it opens Chrome or Edge immediately
But after running the Firefox batch file, if I click on the link in the email, it pops up a “How do you want to open this” dialog, with all the browsers listed.
What am I missing?
The bat file has this in it ( as per above)
SetuserFTA http FirefoxHTML
SetuserFTA https FirefoxHTML
SetuserFTA .htm FirefoxHTML
SetuserFTA .html FirefoxHTML
Im running Firefox version 75.0 (64 bit)
Thanks !
Did you try: setuserfta html applications/firefox.exe
I can’t seem to get the program to work at all: After downloading it I set the command prompt as instructed (SetUserFTA get) and it returned the following message: “SetUserFTA” is not recognized as an internal or external command, operable program or batch file.
@D.H: Please use the full path to the program — e.g., D:\Utilities\SetUserFTA.exe
Try .\SetUserFTA.exe. Have a nice day.
According to virustotal this is a malicious file:
Jiangmin – AdWare.WebNavigator.ae
@JuniorM: It’s most likely a false-positive. The 66 other scanners (via VirusTotal) have cleared the file successfully.
https://www.virustotal.com/gui/file/791dc39f7bd059226364bb05cf5f8e1dd7ccfdaa33a1574f9dc821b2620991c2
This article ASSUMES:
**AN INSTALLED BROWSER!**
Portable browsers are EXCLUDED!
Doesn’t seem to work on 21H2. It goes right back to setting Edge as the default after reboot.
doesn’t work 27.8.22 21H2. tried to change mp4/mkv file associations to vlc and it either gives the usual “choose an app” without the checkmark to keep it that way or rollsback to the stupid ass photos. f** ms man.
@holy-macarony: Please post the command-line you used. I’ll see if I can repro the issue in the same build.
Does you solution cover .lnk defaults?
Can this command apply the default to “all users” instead of “current user”?
I can change the default for current user, but after I create another user, the previous default shown up again.