How To Set Default App File Type Associations in Command Line on Windows 10

2

In the pre-Windows 8 eras, the default app can be set for a file type by manipulating the registry, which means you could craft a script and execute via the command line to change default apps. But the registry trick no longer works since Windows 8, since Windows introduces a hash to verify the change.

So, if you still would like to update the default app via a command line because it’s much more flexible, here is a free replacement for you.

Kolbicz, an IT consultant out in Switzerland, reverse engineered the hash algorithm and wrote a command-line tool, SetUserFTA, that lets you set up default apps based on per-user or group without messing up the default apps for other users on the same computer.

How to use SetUserFTA

It’s fairly easy to use and straightforward.

SetUserFTA.exe get

will show all protected file types. And

SetUserFTA.exe extension progid

will set the default app to the given extension.

For example, to set Edge browser (not the new Chromium version) as the default PDF viewer,

SetUserFTA .pdf AppX4hxtad77fbk3jkkeerkrm0ze94wjf3s9

For Edge Chromium version,

SetUserFTP .pdf MSEdgeHTM

To switch to Acrobat Adobe Standard 2017,

SetUserFTA .pdf Acrobat.Document.2017

This could help those who are having trouble setting up the default PDF viewer based on the XML via Group Policy.

.MHTML Issue

.MHTML, a MIME encapsulation of HTML file is a web page archive format used to combine, in a single file. If you save a web page in .mhtml format, you save everything in one single file, instead of many bits of separate files used to render the page.

While it’s useful, there is a bit of a problem reopening it afterward. The default app associated with .mhtml is Internet Explorer and you know how terrible it is to re-render a page you saved in Chrome. But it’s not that easy to change it.

image 11 - How To Set Default App File Type Associations in Command Line on Windows 10

Now, with SetUserFTA, one line later, it’s done.

SetUserFTA .mhtml ChromeHTML
image 13 - How To Set Default App File Type Associations in Command Line on Windows 10

A few tips to find out the ProgID

The key to using the SetUserFTA command is to find the proper ProgID for the app. The wrong ProgID will result in a wrong hash, which leads to failing the verification.

You can use the built-in assoc.exe.

assoc.exe | find ".xxx"

Or query the registry to get the ProID of the app for a specific file extension.

reg.exe query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.mhtml\UserChoice /v ProgId
image 14 600x102 - How To Set Default App File Type Associations in Command Line on Windows 10

Replace the extension name with the actual one you want to query.

2 COMMENTS

  1. Hi Kent, thanks for the info. Been seeing a lot of useful posts here recently 🙂

    Did you mean “reverse engineered” and not “reverse engrained”?

LEAVE A REPLY

Please enter your comment!
Please enter your name here