Windows 10 – How to Mass-Reassign File Associations in Windows 10 (1803)

file associationpermissionswindows 10

(Skip to the question by scrolling to the very bottom, but in this case don't blindly vote to close …)

Yes, I know this topic has been regurgitated a number of times here, here and here, but I promise this is no duplicate. None of these help associating software with file extensions at a larger scale. In fact I found that – at least with Windows 10 (1803) – you can change the associations more conveniently, but neither the FileTypesMan (I tried version 1.83) trick nor the tools assoc and ftype in tandem worked.

All of these methods failed in that they produced – upon double-clicking a file of the type/extension in question – the RT-style dialog that offered me to "Keep using this app", having "Photos" as the default and then offering a list of potential candidate software to handle the file type below.

I'd like the software of my choosing to open these files without ifs and buts (and extra dialogs).


Example: I wanted SumatraPDF to open a range of ebook file types alongside PDF (defaulting to Edge) and IrfanView to open images. When the applications were installed I got plenty of notifications from Windows that the file associations had been reset. Well, so much for controlling what's going on on my system.

So I started IrfanView as administrator and had it set the file associations. Alas, the UserChoice column in FileTypesMan kept showing AppX43hnxtbyyps62jhe9sqpdzxn1790zetc, which at least on my system corresponds to the Photos (store) application shipping with Windows. For this example I will discuss .bmp files.

When trying to fix the UserChoice column by means of FileTypesMan I was confronted with an error message proclaiming that access was denied. Uhm okay …

So I had Process Monitor show me what key was affected by the access denied error. Sure enough it pointed out the attempt to write values inside HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\UserChoice. So I checked out the permissions on that key and saw nothing suspicious. But on closer inspection in the "Advanced Security Settings" dialog for the UserChoice key I saw this:

Advanced Security Settings

Since my days as system administrator at the university Deny ACEs have been a rare sight, though. Now, being acutely aware of ACE precedence rules inside ACLs it immediately dawned on me that this Deny ACE was the issue. It dominated the ACL for my user account.

A tool such as FileTypesMan would have to actively remove that ACE and then put it back after any manipulation. Evidently it doesn't do that (possibly a defect that I should report?). There's no other way I know of, with the possible exception of acquiring and enabling the backup and/or restore privilege (aka user right) – which amounts to sidestepping the ACL and ACEs (aka cheating through the means of an admin ;)).

Anyway, I was out of luck from that side.


Alas, I found a workaround that worked for IrfanView. However, the same workaround did not work for SumatraPDF and it involved tedious mouse-clicking (and therefore I am asking this question).

The workaround was as follows. Open the "Windows Settings" app, pick "Apps" and then choose the "Defaults Apps" item on the left hand side. Scroll down in the main pane and from the bottom choose "Set defaults by app".

Default Apps

From there find the application – in my case IrfanView – which you want to manage and hit the "Manage" button (after selecting the program of your choice).

IrfanView in the app list

Then a new list opens providing a relatively simple overview of the file extensions that are apparently supported by the program (my guess is that HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.bmp\OpenWithProgids or some other registry setting plays a role here) and lets you change the current setting.

Pick a new program for the file extension

So all is fine, right? Well, nope. While IrfanView made that list for "Set defaults by app", SumatraPDF was nowhere to be found.

While the fact that SumatraPDF isn't listed there may well be the fault of SumatraPDF, this still doesn't excuse Windows from reverting settings I consciously make and fully intended to make.


So while that "Windows Settings" app clearly has the magic sauce to circumvent that Deny ACE, it still doesn't provide an easy way for me to associate any file extensions in batch to a software of my choosing.

Question

So given the situation described above: How can I associate arbitrary file extensions with arbitrary installed software of my choosing at a larger scale (i.e. pretty much in batch) and without tedious mouse-clicking orgies and without risking Windows 10 stepping in and reverting my consciously made choices?

Best Answer

You could make a list of file extensions and corresponding applications which the extension will be run by, for example in Excel, export it to .csv file and use the PowerShell script from the below link: https://gallery.technet.microsoft.com/scriptcenter/How-to-associate-file-3898f323

You can try to edit this script that it would read the .csv file and do proper extension-application assignment.

You should be careful when dealing with .exe extension, as changing its behavior may result in general problems with Windows. Changing all the extensions in a for loop should take no more than few minutes.