Site icon Winhelponline

Change Default Apps and File Association via Command-line

Summary: This post explains how to change the default apps, browser, or file associations using the command-line in Windows 10. This can be accomplished by a console 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.

Exit mobile version