Default File Types On Installation
-
Why doesn’t the installation of Notepad++ prompt you to make it the default for text files? When you install photoshop, or putty, or wireshark, in their installation menu, they have an option to associate their program with the file types and even be the default application. Why doesn’t Notepad++ do this, have an option to just replace Notepad as the default with Notepad++? Or does it and I’ve missed it somehow?
I’ve tried to make scripts and such afterwards to get notepad++ to be the default for all users but then I’ve found people saying those methods are unreliable. (and they haven’t worked for me either). I hate regular notepad and want all of my users to open even XMLs in notepad++
-
The installer adds “Edit with Notepad++” to the RightClick context menu, so it’s available for all filetypes. And you could have your users Open With a text or XML file one time, making sure they elect to always open that kind of file with Notepad++, at which point the decision would stick for that file type.
Plus, there’s the Settings > Preferences > File Association which will allow you to pick which filetypes are associated with Notepad++ from inside Notepad++'s GUI interface.
And finally, if you are in charge of installing for users, you presumably know how to create a .reg file to associate one or more types with a given application (or at least know how to research it): that’s a generic Windows question, and not anything specific to Notepad++.
Please note that you’d want to look up the specific instructions for your users’ various OS versions, because it might change slightly for the “best” way for Win7 vs Win8.1 vs Win10 vs Win11 – for example, Win10 and Win11 both prefer using the answers to the OpenWith question, which are stored on a per-user basis for each file extension in
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\
. Older versions of Windows often defaulted to using the HKCR section for storing the extenion-to-type and type-to-commands keys. Some of my notes for the modern OpenWith registry entries, which seem to be up-to-date for me on Win10 and Win11, are pasted below; I offer this with no guarantee or warranty, nor do I claim that you will be able to understand my potentially-cryptic notes:* File Extension to Application mapping: * Registry Key = HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\ * reference: https://stackoverflow.com/a/3924822/5508606 * ...\FileExts\.ext\OpenWithList\ vs ...\FileExts\.ext\OpenWithProgids\ * reference: https://docs.microsoft.com/en-us/visualstudio/extensibility/specifying-file-handlers-for-file-name-extensions?view=vs-2022 * OpenWithList\ shows the Applications\ name for any that show up in the "Open With" menu - VALUE: if the value is "blah.exe", then it will look in "Applications\blah.exe", described below EXAMPLE: FileExts\.pl\ OpenWithList\ a [REG_SZ] = {1AC14E77-02E7-4E5D-B744-2EB1AE5198B7}\OpenWith.exe b [REG_SZ] = perl.exe ⇒ this will have perl.exe and OpenWith as the "Open With" options * OpenWithProgids\ is similar, but it uses the "progid" * VALUE's NAME: the name of the HKCR\xxxx association-name EXAMPLE: FileExts\.pl\ OpenWithProgids\ pl_auto_file [REG_NONE] = zero-length binary value * CAVEATS: * the note shows it is XP-only... and given it's for the VS2022 documentation, it's not an outdated document which doesn't know about modern Windows versions * despite the XP-only note, my experiments show that it shows up in the "second" level of "Open With" (the first level being the main list, the second being the "choose another app" option, and the third level being browsing for the executable) * https://docs.microsoft.com/en-us/windows/win32/shell/fa-file-types gives the opposite advice, saying ProgIds is preferred * UserChoice\ * If you want to go back to the system default, delete the whole ...\FileExts\.ext\UserChoice key, and possibly the Application Toast (below) * Note that it creates a hash, so you cannot change the user's choice for them ;-) * Application Details * HKEY_CURRENT_USER\Software\Classes\Applications\ * HKEY_LOCAL_MACHINE\Software\Classes\Applications\ * HKEY_CLASSES_ROOT\Applications\ = the first two are auto-replicated into the third; these entries map application names (like notepad++.exe) to the actual command path that implements them * KEY: ...\Applications\appname.exe\ - basically equivalent to the "Association Details" entry in the old style (below) * VALUE (Default): The string that will show up as the name of the file type in Explorer * VALUE FriendlyAppName: The string that will show up in the "Open With" menu. If missing, it will get it from elsewhere. * KEY DefaultIcon\ * VALUE (Default) [REG_SZ] = (optional) The default icon for all file types that are set to OpenWith this Application * KEY Shell\ = (optional) works just like the "NameOfAssociation\Shell" key above * VALUE (Default): default (double-click) verb * KEY _verb_\: there can be more than one _verb_, just like in "Association Details" * VALUE (Default) [REG_SZ] = human readable version of Verb name; if missing, it will use the name of the _verb_ KEY * VALUE Icon [REG_SZ] = (optional) path to icon that will show up in the RightClick menu for this verb * KEY command\ * VALUE (Default) [REG_SZ] = c:\path\to\executable "%1" %* * KEY SupportedTypes\ = (optional): a list of extensions that this application supports (which may help with the OpenWith) * VALUE .ext [REG_SZ] = empty string. The name of the value should be dot-extension; have one VALUE for each extension that the app wants to claim * Application Toasts * HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ApplicationAssociationToasts = have value names like Applications\some.exe_.ext, where Applications\some.exe is found in one of the ...\Applications\ keys above, and .ext is the extension being associated with the application * You may need to remove the Toasts as well as the UserChoice when trying to undo an unwanted OpenWith that doesn't seem to go away * Other references: - https://stackoverflow.com/a/41743662 : Classes\MyApp vs Classes\Applications\MyApp.exe
-
I understand there are ways to get it done via registry keys, However that is a lot of keys to mess with for the GPO.
My question wasn’t so much, “How can I make it default?” but rather why isn’t this an installation option? Better yet, an command line options when you do a silent install to include file types. Many other installations offer this as an option. I’m a bit surprised it is not highly requested feature. After all, most people that use Notepad++ never want to see Windows Notepad again…
-
@John-Furby said in Default File Types On Installation:
My question wasn’t so much, “How can I make it default?” but rather why isn’t this an installation option?
It’s called a “design decision”. The designers of every application in existence make them. As a user, you disagree with some and agree with others. If what you like about an application’s design decisions outweigh what you don’t like, then you continue to use the product, otherwise you find something else that’s more to your taste. Since you paid nothing for this software, the only thing you need to lose is your time.
“Why” can actually be a strange question to ask w/r/t design decisions, because sometimes it really was just a preference or even an arbitrary choice by the designer at some moment in time.
But since you asked: my guess as to the “why”: the Settings > Preferences > File Association was the developer’s answer to the request to be able to easily associate file types with Notepad++. Because why stop at just .txt ? or just .txt and .xml? or txt and xml and HTML and c/c++/h and py and … And what about the people who want .txt associated with something else but .npp associated with Notepad++?In other words: the designer probably felt that the user interface already in the app was better suited to handle all the exceptions that people would want, rather than during the installation process ask for the 217 extensions across the ~90 languages that are known during initial installation, most of which the user wouldn’t care about (when the designer could not know which would be the important extensions to a given user; for some, TXT and XML are the important ones; for others, they never edit those, and only touch C/CPP/H; for others, some other combination – making any choice to favor one set of extensions above another would be bound to annoy a not-insignificant subset of users as much as the current situation annoys you.)
If you want a one-stop location to change the associations, which will ask for the “major” extensions (whatever that means) plus allow you to add your own extensions, the Settings > Preferences > File Association was designed to do exactly that.
I’m a bit surprised it is not highly requested feature.
I’m not. (The following is my interpretation of events as I understand them.)
For years, Windows made it easy for applications to set the default associations. And for years, new applications would hijack filetypes without permission. And even those that did play nice and ask would still mess with things in an annoying way (for example, once you associated .txt and .xml with Notepad++, it would show up as “Notepad++ Text File” for all of them, rather than keeping the individual identities of “Text Document”, “XML Document”, and the like).
As such, MS got a lot of complaints about how annoying that system was, and how hard it was for users to change the defaults if the app didn’t play nice (or if they didn’t remember where each app buried their un-associate ability).
So MS started giving users the “Open With” possibility, to make it easy for the user rather than the application/installer to change the default app for a filetype, and simultaneously made it harder for (non-Microsoft) applications to actually get the default-app status when they asked for it. Many users find this a win, not a loss (except that MS apps don’t follow their own guidelines of not hijacking file types).
Most Notepad++ users only have a few filetypes, so it’s not onerous for them to change their Open With for that handful of filetypes. Especially because, for non-associated file types, **Right Click > Edit With Notepad++ ** still works to open them quickly in Notepad++.
For those who have more filetypes which they’d like to associate, the Settings > Preferences > File Association is usually the next best action.
If that’s not sufficient, the Online User Manual has a section on Notepad Replacement which uses a Registry hack to make it so that any time that Windows tries to run
notepad.exe
, it really runsnotepad++.exe
instead).And for the remaining users who have more than a handful of types, but who do not wish to go so drastic as to try to trick the OS, they generally know how to dig into the registry and change their associations more powerfully than any installer or Open With could.
But I, like you, am just a user of Notepad++, and my opinion only matters as much as yours, not any more and not any less. You can discuss new features here in the Community Forum all you want, but it’s not the official feature request location (see our FAQ), so this discussion will not result in any official decision.