📢 SFTA.exe Latest Update 2020-09-14
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.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.pdf\UserChoice

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.

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
Set Google Chrome as Default for http Protocol :
SFTA.exe ChromeHTML http
I hope this tool will be useful.
SFTA Changelog
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.
[Unreleased]
1.3.1 – 2020-09-14
Changed
- Hash Algorithm Raw PureBasic Code
1.3.0 – 2020-04-24
Added
- Add Protocol Support
- Add Icon Support for File Type
1.2.1 – 2019-12-13
Added
- Add –list Show All Application Program Id
Fixed
- Fix –get command
1.2.0 – 2019-12-12
Added
- Add Hash Algorithm Method to handle the latest Versions of Windows 10
1.1.0 – 2019-08-07
Added
- 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
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.
Hello, Could you tell me what is your Windows version?
Did you try with other file type?
Does It work?
Regards
Hi Are you willing to provide source for this application so it can be confirmed it doesn’t do anything malicious?
Hello Kevin. We will share source code on github soon. Regards
Hi Kelvin,
I am interested in your work too. Wish to see your source code soon.
Thanks for your great job.
Hello Jason, Source code is already available on GitHub
Regards
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.
Asad
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.
Regards
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
Hello @Geo One. It seems to be the Interface for Windows 10 1903 version is different. We’ll look into to fix it. Thank you
Hello!
I wonder if it has already been fixed?
Grateful for the help!
Thank you!
Luiz
Hello, Updated Working in 1909.
will test it this weekend
Hi Danyfirex,
First off all thanks for the the tool, it’s been a life saver.
Did you ever get around to fix this for 1903?
Try the latest version. Regards
Any news for Windows 10 1903 version ?
SFTA has been updated, Regards
any news on SFTA not working on Win10 1909 ?
it works now!!! 🙂
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.Updated:
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.
Regards
Seems have found the problem – by bad. Need to use:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer]
“NoNewAppAlert”=dword:00000001
or
[HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\Explorer]
“NoNewAppAlert”=dword:00000001
and the popup dialog dissapears.
Sorry.
That’s great Alexander, Thank you for notify it.
Regards
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?
Hello Kevin, I about protocols support weeks ago. We will update as soon as possible to support protocols. Regards
Perfect, thanks for the fast reply! 🙂
Hi Dany, could you make any progress yet by any chance? Anything I can do to help?
Hello!!! I’m about to finish it. I’ll post it in some hours.
Regards
Hi Dany,
Thank you so much for this tool! I had never seen PureBasic project in my life before I saw this so I guess I got to geek out a little bit as I was going through this. I still suck at reading it though. I love that this is open source, but do I understand correctly that all of this is readable code except for the GenerateHash function which is hidden away in the hash.a (compiled in C?) file?
My apologies if this is a silly basic coding question I should know the answer to.. but any pointer you could provide would be greatly appreciated.
Cheers.
Hi, I got the hash using a debugger so It was a very messed C routine that I compiled to static library. I’m planning to convert the hash routine to raw PureBasic code, but haven’t had a chance to do it yet.
Regards
Hi Dany,
Thank you for the quick reply! That would be awesome and would really help so I’ll look forward to that.
Cheers.
Hi, Danny. Thanks for your great work! It works like a charm. But I want to ask a further question. I’m trying to associate FTP protocol with a custom program. And in this custom program I intend to forward the FTP url (a file on FTP) to different applications according to the extension of the file (on FTP) and the system default applications settings. I can get all the system associated ProgIds with the help of your SFTA.exe. But how can I invoke the application (with a proper format) if I know the ProgId? Wonder if you have any suggestions on achieving this? Thanks!
Hello Zezheng. I’m not sure If I understand what you’re trying to do. But Basically You would associate the FTP protocol with your Custom App like this:
SFTA.exe "YourAppID" "ftp"
If You don’t have your App registered:
SFTA.exe --reg "C:\MyCustomApp.exe" "ftp"
After that You will be able to pass the FTP url as parameter to your custom application like this using a cmd prompt:
start ftp:\\YourFTPFile.txt"
That will invoke your CustomApp with the url as parameter.
Regards
Hola Amigo muchisimas gracias funciona excelente, pero tengo una duda, hay manera de que al ejecutar SFTA.exe AcroExch.Document.DC .pdf funcione para todos los usuarios en el equipo? ya que actualmente solo funciona con el usuario en donde se ejecute, y al iniciar sesion en otro usuario no está acrobat predeterminado.
De antemano agradezco tu respuesta.
Saludos desde Guatemala
Hola Francisco. Actualmente funciona solo para el Usuario donde se ejecuta. Intentare agregar esa característica en la próxima versión.
Saludos
Muchisimas Gracias Dany, me serviría mucho para cambiar opciones remotas pormedio de psexec y que se apliquen a todos los usuarios de una sola computadora.
Gracias nuevamente
Hi Dany, thanks a lot for your work. It is highly appreciated that you share your source code!
Do you know if there are any plans to make a new Powershell version for 1809 and higher ?
Hello Chirs, A few weeks ago I was writing a full version in Powershell, but then I did not finish it. I’ll try to get my hands on it again.
Hello
I’m really looking forward to the powershell version.
Although if I could get the hash algorithm privately, I could already use it without the full script and thank you very much for that.
Hello BadBull, You can email me at hello.danysys@gmail.com to discuss further. Regards
Thanks, this works wonderfully. I’m confused as to why they make it so hard for us to set an association for specific users. Is this some sort of protection that MS implemented, and will they eventually break your tool?
Hello! I’m pretty sure Microsoft added it for security reasons. I’m not sure if they will make changes that break my tool anyway. I will try to keep it updated when it happens. Regards