I have spent a very long time researching this. Most of the solutions were posted PRIOR to April 2018, and involved working your way through the "settings" to get to "Choose default Apps by file type".
Choose default Apps by file type
In previous attempts to assign an app to ".rex" I managed to assign it to Notepad. (At that time, I could not find any way to find an ".exe" on my C: drive.)
So as you can see, if you click on Notepad next to the .rex extension, the only option is to go to the "App store".
And as expected, if you click on App store, nothing is found...
So from what I've read in multiple forums, PRIOR to April 2018, Windows 10 still had a way to "browse your hard drive" to find an ".exe". (Just like in older Windows versions.) After some update in April 2018, that capability no longer exists.
In the POST April 2018, has anyone found a way to assign a file extension to an ".exe" on the hard drive???
I think this question would be more suitable for SuperUser (well, unless you want to do it via a program :) ).
Anyway, here's a way of doing things from console (cmd). I've tried it 1 or 2 years ago, I just tried it now, so it works regardless of Win (10) version.
Start the process from scratch:
Open a Command Prompt Window. Create a new file that the OS doesn't know anything about. I chose the extension .zzz:
Try opening the file (DblClick) from a file browser (it's not relevant, but I use Total Commander), or by typing its name in cmd. That will yield the dreaded dialog:
Create a new file type and associate our extension with it. [MS.Docs]: assoc utility is used to do the job. First, check if such association doesn't already exist:
No change when trying to open the file.
Associate the file type (ZZZFile, from previous step) with a command. Use the [MS.Docs]: ftype tool for the task. Again, check if the file type is not already associated (this only makes sense if the file type existed before previous step):
Try opening the file again (from cmd), and voilà:
Summary:
In order to open with notepad.exe files having .zzz extension, there are only 2 commands that need to be remembered from this whole (and pretty long) answer:
assoc .zzz=ZZZFile
ftype ZZZFile=%SystemRoot%\system32\notepad.exe %1
Notes:
@EDIT0:
I did a little more digging on the .txt mystery. Facts:
So apparently, it's more than meets the eye (over the years, I got used to MS's way of doing things which in some cases seems to be (but maybe it's me who didn't have all the pieces) ilogic). I've also found out many resources like:
I couldn't find anywhere a clear algorithm of how an executable is chosen to run a file with a certain extension. I can think that the 2 keys above are queried, but I'm 100% sure there's more. Not to mention that I've ran into an even stranger problem (for a regular user on my Win 10), for .py files:
Sadly, I selected Python from the dialog, before taking a look at the reg keys (and now it works), so I can't do any more debugging (and also, switching users is annoying).