Set File Type Association Default Application Command Line Windows 10 UserChoice Hash Internal Method

📢 SFTA.exe Latest Update 2019-08-13

Recently one of my clients has asked me to change the default program associated with the extension  . pdf  to Acrobat Reader DC on Windows 10, all in an automated way. The first thing that comes to mind is to change it through the registry by editing the registry key UserChoice.

UserChoice Registry Key – Hash – ProgId

Hash entry that is generated automatically by Windows to validate the integrity of file type association.
ProgId entry is the Registered Application Id that handle the file type.

The main problem is that in recent versions of Windows 8/10 This key is protected by a hash associated with the file type, and succeeding in editing it without generating the valid hash the association is automatically restored to the default application.

Doing a quick search on Google I found some ways to do it, using GPO(Group Policy Object) or importing a .xml association file with DISM.exe, but they were a little extensive processes, after a deeper search and taking into account that my client needed a quick fix I found this little command line tool SetUserFTA.exe created by Christoph Kolbicz which complied with what was required and I opted to use momentarily, however I was intrigued to be able to include this method directly in an application developed in another language such as C++, AutoIt, Pascal or PowerShell.

After a couple of days fighting against Windows and doing some Google research, I manage to find the method that uses Windows internally and develop a code to implement in the application of my client.

I developed a small command line tool in PureBasic to perform this task over Windows 8/10 which is very simple to use.

SFTA Command Line Tool

Sample Usage:

Set Acrobat Reader DC as Default .pdf reader:

SFTA.exe AcroExch.Document.DC .pdf

Set Sumatra PDF as Default .pdf reader:

SFTA.exe Applications\SumatraPDF.exe .pdf

I hope this tool will be useful.

SFTA Changelog


All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.


1.1.0 – 2019-08-13


  • Add –reg Register Application Program Id
  • Add –unreg Unregister Application Program Id
  • Add –debug Display Debug Information
  • Add Windows 10-1115 Support – Thanks to Mehdi

1.0.0 – 2019-01-22

First Release

10 thoughts on “Set File Type Association Default Application Command Line Windows 10 UserChoice Hash Internal Method

  • I tried the command line:
    sfta.exe -h
    this works fine.

    However, the next command line:
    sfta.exe -g “.txt” returns : “Error. Unable To Query Associated Application” when my .txt files are associated with notepad.exe.

  • I tried to change association for .htm but the only thing it did was to break the existing association. Next time when I double-clicked a .htm file Windows asked me what program I wanted to open the file with.

    Command I used: sfta –reg “C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe” “.htm”
    OS: Windows 10

    Next I checked the code from github. That does not seem to include calculation of the Hash.

    Dont know what I am doing wrong.


    • Hello @Asad, Seems to be you have already installed Chrome so It already has Program ID registered. You just need to do this.

      SFTA.exe "ChromeHTML" ".htm"

      About “calculation of the Hash” It’s is done by the interface IApplicationAssociationRegistrationInternal internally.


  • Looks like the tool is not working.

    PS C:\Windows\System32\WindowsPowerShell\v1.0> sfta -d “FoxitReader.Document” “.pdf”
    [2019.10.17 16:28:15] OSVersion = 110
    Windows Version: Windows 10
    Windows ReleaseId: 1903
    Windows Build: 18362
    Windows ProductName: Windows 10 Enterprise
    [2019.10.17 16:28:15] Is Windows 10
    [2019.10.17 16:28:15] FAIL AssociationRegistration Instance

Leave a Reply

Your email address will not be published. Required fields are marked *