Windows 10 file associations and ShellExecute("edit"...
-
When using a third-party program, how do I make it open .txt files in Notepad++ instead of in Notepad? According to the program creators, it opens text files using the command
‘ShellExecute(“edit”…’, which apparent defaults to notepad, even thought my WIndows 10 had .txt associated with Notepad++Opening a .txt file on the desktop opens Notepad++ correctly.
I have been told that it is a question of some registry editrs, but Google won’t tell me which.
-
As I mentioned in another thread, my registry associates .txt with the
HKCR\txtfile
key; yours may be different: you can look inHKCR\.txt
to determine the right association for your machine. Assuming my setup:You’ll notice the three keys “open”, “print”, and “printto”: mine does not have an “edit” key. So if they are really using the hardcoded “edit” key, rather than the default action (listed here as
HKCR\txtfile\shell:(Default)=open
), then it’s a poor choice on their part, because there is no guarantee that the “edit” key exists for a given association on a given machine.!!WARNING!! What I am about to explain involves editing the registry. This has associated risk, and should only be followed if you understand everything said, and are willing to take all responsibility for any change in behavior that occurs in your system. I make no guarantee or waranty regarding the effectiveness or safety of the following. (If your computer stops working, or doesn’t work the way you want it to, it’s not my fault.) Use at your own risk.
You may be able to work around their choice. Right click on
shell
, selectNew Key
=edit
. Right click onedit
, selectNew Key
=command
. Left click onopen
>command
, double click on(Default)
, and copy the path to NPP (if your default isn’t “open”, but some other key, then use thecommand
from that key, instead); left click onedit
>command
, double click on(Default)
, and paste the path to NPP. Exit the registry editor. (Some people say that they need to reboot, or at least log out and back in, or perform other similar actions to make sure the registry has fully updated… but my guess is just closing the registry editor and closing/reopening the third-party program will be sufficient.) In general, this should create the new “edit” action, which will execute the same command that the “open” action executes.