SetUserFTA - Windows 10 File Association CLI utility

Submit command line tools that you find here.
Post Reply
Message
Author
User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

SetUserFTA - Windows 10 File Association CLI utility

#1 Post by Cornflower »

I found a freeware CLI program *after* my last Windows 10 updates, where I manually reset so many file associations to my portable apps.

SetUserFTA is designed specifically to solve this problem.

Steps.

1.
SetUserFTA get >configfile
This creates a text file with all the Microsoft private associations (not all your associations
2.
Edit the configfile with a text editor
Each line is in format
.extension, ProgID
The ProgID is deep inside the Classes of the Registry, and can be in more than one spot, so this is handy

3.
Add or change any associations you want in the configfile
You can use paths to your applications, if you haven't associated anything with them yet

4.
SetUserFTA configfile
This will replace the MS Private associations

You can also do one-off associations from the command line without creating a configfile
SetUserFTA del .ext
SetUserFTA .ext ProgID

One more thing, it appears that you can edit where ftp, http, https, mailto etc. are directed. I haven't yet tested this functionality.


Website: https://kolbi.cz/blog/2017/10/25/setuse ... -per-user/

Download: https://kolbi.cz/SetUserFTA.zip

User avatar
webfork
Posts: 10818
Joined: Wed Apr 11, 2007 8:06 pm
Location: US, Texas
Contact:

Re: SetUserFTA - Windows 10 File Association CLI utility

#2 Post by webfork »

Cornflower wrote: Tue Dec 15, 2020 6:44 am SetUserFTA is designed specifically to solve this problem.
Good to get more info there -- please let me know if you figure out a workaround for the ProgID problem (I had trouble figuring out ProgIDs for a given program, especially if there's an installed and portable Firefox on the same system).

User avatar
Cornflower
Posts: 244
Joined: Fri Aug 31, 2007 7:58 am
Location: Canada's capital

Re: SetUserFTA - Windows 10 File Association CLI utility

#3 Post by Cornflower »

I haven't played with it much yet, but here is the Tips section from the author,
  • assoc.exe | find “.txt” – this will list the ProgId for txt files
  • ftype.exe | find “txtfile” – will list the executable associated with the ProgId txtfile
  • reg.exe query HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.txt\UserChoice ProgId – gets the ProgId of the User FTA for your file extension
  • if you encounter a ProgId that looks like “Applications\uedit64.exe“, you need to deploy the corresponding entry from “HKEY_CURRENT_USER\SOFTWARE\Classes” aswell. to roam it with UPM in a Citrix environment you can use my workaround.
  • you can override HKLM associations (ProgId’s) in HKCU. for example: HKEY_CLASSES_ROOT\.vsdx can be imported to HKEY_CURRENT_USER\SOFTWARE\Classes\.vdx and then it will be prefered. if you do that, you need to roam it properly (UsrClass.dat).
  • if you still see the OpenWith dialog (especially after adding new applications: “keep using this app“) you can disable this feature with this registry key:[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\Explorer] “NoNewAppAlert”=dword:00000001
  • this registry key also works with HKEY_CURRENT_USER!
  • the GPO Do not show the ‘new application installed’ notification (Windows Components, File Explorer) will only work on HKLM – but its also an option to disable this popup
Starting with assoc, then moving downward,here is what I found for .htm on this machine (Win 10 home)
  • C:\ut\Command>assoc .htm
    .htm=htmlfile
  • C:\ut\Command>ftype htmlfile
    htmlfile="C:\Program Files\Internet Explorer\IEXPLORE.EXE" %1
  • C:\ut\Command>reg.exe query hkcu\software\microsoft\windows\currentversion\explorer\fileexts\.htm\userchoice progid
    REG_SZ Hash 8iNEeeqwSPs=
    REG_SZ ProgId FirefoxHTML-9301B5C3CD38B886
Assoc and ftype were each enough for .xls to send to Spread32 for me.

I discovered with

Code: Select all

SetUserFTA get
that my .htm and .html were pointing to different ProgIDs, so I was able to change the config file to make them both the same and it accepted it. I'll look later on my laptop which has a few bugs and report if I see anything significant.

User avatar
Andrew Lee
Posts: 3052
Joined: Sat Feb 04, 2006 9:19 am
Contact:

Re: SetUserFTA - Windows 10 File Association CLI utility

#4 Post by Andrew Lee »

This is a super useful CLI tool. Unlike assoc and ftype, SetUserFTA does not require admin privilege to execute, which is even better.

What I would like to explore below is how to create an association for a new file type. For this, one needs to use ftype running under an elevated command prompt. For example, I was trying to create an association for a portable instance of FreeCAD. The filetype is .fcstd. So I issue the command:

Code: Select all

ftype fcstdfile=x:\freecad\bin\FreeCAD.exe "%1"
Now I can issue this command in an unelevated command prompt:

Code: Select all

SetUserFTA .fcstd fcstdfile
and I can double-click on any .fcstd file and it will launch it in FreeCAD.

As a bonus, suppose fcstdfile points to a batch file eg.

Code: Select all

ftype fcstdfile=x:\freecad\FreeCAD.bat "%1"
I can change the icon associated with fcstdfile using an elevated CMD:

Code: Select all

reg add hkcr\fcstdfile\DefaultIcon /ve /d "v:\windows\freecad\bin\FreeCAD.exe"

Post Reply