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

📢 SFTA.exe Latest Update 2019-12-13

Tested in: Windows 8, Windows 8.1, Windows 10 Version 1511, Windows 10 Version 1709, Windows 10 Version 1803, Windows 10 Version 1809, Windows 10 Version 1903, Windows 10 Version 1909

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.2.1 – 2019-12-13


  • Add –list Show All Application Program Id


  • Fix –get command

1.2.0 – 2019-12-12


  • Add Hash Algorithm Method to handle the latest Versions of Windows 10

1.1.0 – 2019-08-07


  • 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

29 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

  • Not working 🙁
    C:\Users\User\Desktop\SFTA-1.2.1>SFTA.exe -d “7-Zip.rar” “.rar”
    [2020.01.21 10:56:00] OSVersion = 110
    Windows Version: Windows 10
    Windows ReleaseId: 1909
    Windows Build: 18363
    Windows ProductName: Windows 10 Enterprise
    [2020.01.21 10:56:00] Is Windows 10
    [2020.01.21 10:56:00] FAIL AssociationRegistration Instance
    [2020.01.21 10:56:00] Experience String Found
    [2020.01.21 10:56:00] Hash: LPFBiCwvmtk=
    [2020.01.21 10:56:00] Write Reg UserChoice OK
    [2020.01.21 10:56:00] SetFileTypeAssociation Hash Method OK

    • Hello @Alexander, Did you try with other application? maybe a PDF for testing. Are you sure 7-Zip.rar is the correct Application ID for 7zip? Make sure to pass the debug parameter (-d) at the end.
      Seems to be 7-Zip does not register the Application ID by default. You would need to go to 7-Zip’s menu Options and add .rar type, it registers Application ID and this command will work SFTA.exe “7-Zip.rar” “.rar”. If you want to avoid manually change 7-zip options you can use SFTA’s -r command, It will register the Application ID and associate it automatically with this command SFTA.exe -r “C:\Program Files\7-Zip\7zFM.exe” “.rar”

      • The same 🙁

        C:\Users\User\Desktop\SFTA-1.2.1>SFTA.exe -r “C:\Program Files\7-Zip\7zFM.exe” “.rar” -d
        [2020.01.21 17:12:07] OSVersion = 110
        Windows Version: Windows 10
        Windows ReleaseId: 1909
        Windows Build: 18363
        Windows ProductName: Windows 10 Enterprise
        [2020.01.21 17:12:07] Is Admin
        [2020.01.21 17:12:07] Application Program Id = “SFTA.7zFM.Application”
        [2020.01.21 17:12:07] ASSOC Return = 0
        [2020.01.21 17:12:07] FTYPE Return = 0
        [2020.01.21 17:12:07] Is Windows 10
        [2020.01.21 17:12:07] FAIL AssociationRegistration Instance
        [2020.01.21 17:12:07] Experience String Found
        [2020.01.21 17:12:07] Hash: z7+k4YXuUig=
        [2020.01.21 17:12:07] Write Reg UserChoice OK
        [2020.01.21 17:12:07] SetFileTypeAssociation Hash Method OK

      • And this is for Adobe Acrobat XI Pro 11.0.23 and pdf extension. It change the icon, but when I click the pdf file – annoying dialog with program selection popups (Acrobat is selected already in that dialog, and if I tell to use that app everytime – everything is OK).

        C:\Users\User\Desktop\SFTA-1.2.1>SFTA.exe “Acrobat.Document.11” “.rar” -d
        [2020.01.21 17:15:25] OSVersion = 110
        Windows Version: Windows 10
        Windows ReleaseId: 1909
        Windows Build: 18363
        Windows ProductName: Windows 10 Enterprise
        [2020.01.21 17:15:25] Is Windows 10
        [2020.01.21 17:15:25] FAIL AssociationRegistration Instance
        [2020.01.21 17:15:25] Experience String Found
        [2020.01.21 17:15:25] Hash: TM8D+ZHHTCo=
        [2020.01.21 17:15:25] Write Reg UserChoice OK
        [2020.01.21 17:15:25] SetFileTypeAssociation Hash Method OK

        • Try this command and post console output.

          SFTA.exe -r "C:\Program Files\7-Zip\7zFM.exe" ".rar" -d

          I’ll do some tests to check what’s going wrong because It’s working fine in my side.


          • Seems have found the problem – by bad. Need to use:




            and the popup dialog dissapears.

  • Hi Danny, thanks for this tool. It seems like it doesn’t work for the default browser setting (which modifies the protocols http and https, additionally to the .htm and .html file extensions.
    When you use SFTA.exe MSEdgeHTM .https the modification needs to be written here: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice

    Same with .http. Is there any chance you can add the different registry paths for these two protocols?

Leave a Reply

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