Replace Notepad on Windows 11
-
@Neil-Schipper Thanks. In my Windows 10 system, I had replaced Windows Notepad with Notepad++ using the registry hack. Essentially what the hack did that it opened Notepad++ for all the files that would otherwise open in Notepad. A cool hack! I did not have to individually set Notepad++ program to open e.g. .txt, .log, ,ini etc. files. Unfortunately, that hack is not working for me in Windows 11 though many have reported that it works. Hence the query.
-
@Stefan-Pendl What I was referring to was a universal replacement for Notepad so that instead of files getting opened in Notepad they will open in Notepad++. In this scenario, I do not have to individually change the setting for files such as .txt, .ini, .log etc. Hope I am clear now.
-
Yes, I was aware that you wanted a simple hack, but a hack is a hack.
I never had any problems assigning N++ as the default application through the regular way.
If Microsoft changes something, than one will have to revert back to the regular way of doing things. -
@Stefan-Pendl Thanks again. Looks like MS did change something. The hack does not work anymore, though numerous sites mention that it still works.
Well back to doing it the hard way! Change the “Open with” program to Notepad++ for at least the text files.
Hopefully MS changes this in the near future.
-
@mmjoshi For what it’s worth, I’m a many-years Np++ user, and I don’t have any file types associated with it, for three broad reasons:
-
Feature richness of Windows: WinExplr right-click menu; ability to create shortcuts to files & subdirs, Desktop, Quick Access, Taskbar, Alt-Tab
-
Feature richness of Np++: support for Drag n Drop; Session persistence; ‘Open File’ uses the subdir of the active file; ‘Open containing file in explorer’; Project Panels; Recently Closed Files; Session Manager plug-in; Explorer plug-in
And I don’t routinely use everything I mentioned. And I’ve probably left some things out.
From all that richness, it’s easy to set things up so files & subdirs I work with are nearly always conveniently at hand, and I rarely have to go trudging through subdirectories, whether using the File|Open dialog or Windows Explorer, and I rarely miss the ability to double-click to get something into Np++
Which brings me to…
- I love having boring old feature-poor super-reliable Notepad.exe as the default for most/many file types.
Np++ (perhaps due to my reckless use of it) can get into a wonky state. The price of feature-richness is complexity, change, and a bit of fragility. It’s like always having candles and matches on hand (and knowing exactly where they are), and cans of sardines…
Don’t feel I’m coming down on you. You know your workflow, and you should be the best master and architect of your toolkit that you can be. I’m only typing this up now because over the years I’ve seen & heard lots of folks fretting over various inconveniences (and I’ve done my share), and this monologue has been building in my head, and so I wanted to let it out.
-
-
From what my research has shown (which is all I can do, since my PCs haven’t started telling me to install the new versin yet), Windows 11 has tweaked the way that file associations work again, making it less convenient to do things the “old” way that’s compatible with historical Windows versions.
In the “old” way, instead of manually overriding every extension separately to associate it with Notepad++, you could just edit the
txtfile
entry in regedit to make it point to Notepad++ instead of notepad.exe: I never had a reason to use that hack (and that’s what it was; the “debug” option that it makes use of was never intended for “notepad.exe replacement”) that’s been around for years.Like @Neil-Schipper , I haven’t bothered associating most file types with Notepad++, but for a very different reason: . My reason is that Notepad++ often installs an option for all files that says “Open with Notepad++” in the main right-click menu, or in Windows 10 and earlier, I know how to create one if a particular Windows machine doesn’t get that right-click verb. My research has shown that Windows 11 tries to hide such verbs, but you can google for workarounds to show alternate verbs.
@Neil-Schipper said,
I love having boring old feature-poor super-reliable Notepad.exe as the default for most/many file types.
Np++ (perhaps due to my reckless use of it) can get into a wonky state.I actually highly disagree with those reasons. First, because I only want MS Notepad to appear when I intentionally invoke it (and usually only for when I’m editing the config files of Notepad++, or want a temporary “visible clipboard” to hold the results of my Notepad++-config-file-diff when I’m upgrading from one Notepad++ to a newer one, and I have to close all instances of Notepad++, but still want my list of changes easily available. Second, because I have never seen Notepad++ get into a wonky state, except when I am experimenting with something I know is dangerous (usually involving my “Perl Script” module which externally manipulates Notepad++) or when I am intentionally corrupting a portable copy to try to replicate a problem that someone has asked about in the Forum.
-
@Neil-Schipper That’s a new way of looking at my workflow. Thanks. Would try this out. A great advantage here is I do not have to tinker with registry settings every time I do a clean install of Windows, which in my case happens to be a lot of times!
I use the portable version of almost all the programs, Notepad++ included. Helps me with my frequent clean installs. Is there a way where I can add Open with Notepad++ in the right click menu? Would be convenient.
-
@PeterJones I am more inclined to not replace Notepad with Notepad++. However, since I use the portable version, is there a way to have the “Open with Notepad++” in the right click menu? Would be very convenient, especially opening the .bat or .reg files.
-
I have low tech suggestions only, and they’re only useful if your installs use a very consistent dir structure, ie, most apps & data files usually in the same place… (and sorry if you already know all this)
-
Maintain a subdir full of shortcuts that each launch Np++ to open one (or several) of the (5? 20?) files you expect to edit, that might cover 90%+ of your needs. (Of course, you’d maintain a master copy of that subdir on a memory stick, cloud, etc.)
-
A batch file, run once, could copy shortcuts to Np++ (with or without a target file specified) to “all” the places where your editables normally reside.
-
Learn to hack the appropriate Np++ xml file so that the files/places you care about magically appear in Np++ (in the session file, in Project Panels, in Recently Closed Files list) the first time you start it after a clean install.
Again, if installs are highly uniform, you don’t have to hack; rather, learn which config files capture your finely tuned Np++ environment, keep them safe, and always restore with each install.
Or, run portable Np++ with its config environment from a mem stick. You’ll always be refining it (or even them – an environment for each type of install), and it will always be ready to go after an install.
So Np++ will be sort of acting like WinExplr for frequently accessed files. Also, preferences like colors, fonts, shortcuts, etc. will always be at hand
Sorry if you already know all of this. I expect someone will figure out how to do what you’re really asking for in not too long.
-
-
@mmjoshi ,
I do not have Windows 11 to verify. However, on Windows 10 and earlier, if you go into the registry, in
HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell
, and right click “New Key”, add one named something likeNotepad++
, set the(Default)
forNotepad++
toEdit with Notepad++
; then right clock on theNotepad++
on the left, add a new keycommand
, and set the(Default)
to something like"C:\usr\local\apps\notepad++\notepad++.exe" "%1"
(where you would use your path to notepad++.exe, not my path).Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\Notepad++] @="Edit With Notepad++" [HKEY_CURRENT_USER\SOFTWARE\Classes\*\shell\Notepad++\command] @="\"C:\\usr\\local\\apps\\notepad++\\notepad++.exe\" \"%1\""
However, as I said earlier, it looks like Windows 11 doesn’t always show all the verbs; you can use your favorite search engine to search the internet for
windows 11 not showing all right-click actions
or similar; I do not have Win11, so cannot do tests to tell you what exactly will work. -
@Neil-Schipper Thanks for your suggestion. Ultimately figured out a way to add “Open with Notepad++” to the right click menu in Windows 11. Takes care of my needs. Boy, Windows 11 is surely tough to customize to the ways one worked in Windows 10!
-
@PeterJones Thanks. Worked in Windows 11 too! Windows 11 has certainly made it harder to be customized to the look and feel of Windows 10!
-
A little late to the party but if you’re using a portable version, you can add it to the “Send To” list on a context menu by opening File Explorer, putting “shell:sendto” in the address bar, and in that directory add a new shortcut to your portable Notepad++.exe. Hopefully SendTo isn’t borked in Windows 11 too.
-
Here is a possible solution for those who want to replace Notepad.exe with NotePad++.
The previous hack still works if you set the redirection registry settings underneath it. The following batch file code shows a solution.
@ECHO OFF & CLS & ECHO. NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO You must right-click and select & ECHO "RUN AS ADMINISTRATOR" to run this batch. Exiting... & ECHO. & Timeout /t 10 & EXIT /B) REM ... proceed here with admin rights ... REM http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator SETLOCAL :: reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad++.exe" /f ::Use the the following comment to undo the replacement: :: reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f ENDLOCAL GOTO :EOF Technical Notes Replace Notepad on Windows 11 The following code Reverses the change ```@ECHO OFF & CLS & ECHO. NET FILE 1>NUL 2>NUL & IF ERRORLEVEL 1 (ECHO You must right-click and select & ECHO "RUN AS ADMINISTRATOR" to run this batch. Exiting... & ECHO. & Timeout /t 10 & EXIT /B) REM ... proceed here with admin rights ... REM http://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator SETLOCAL ::Use the the following to Reset the default for Windows 11 notepad.exe to undo the replacement by Notepad++ reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2" /v "FilterFullPath" /t REG_SZ /d "%ProgramFiles%\Notepad++\notepad.exe" /f ENDLOCAL GOTO :EOF Technical Notes Replace Notepad This has only been lightly tested but works for .cmd files and .txt files and perhaps others. Let us know if there are issues.
-
@jadelise Thanx… works great.
-
@ChaosDMNS Yup, it works! I’ve just tried it on Win11 22H2. Thanks, @jadelise ! 🙏🏻
-
Are you sure the batch file you provided still works in Windows 11?
I’ve tried it but it doesn’t work (*.txt are double clicked, but always notepad.exe is launched) on my Windows 11 Home Edition version 21H2.
ps. I didn’t uninstall notepad.exeEdit: Obviously, Notepad UWP has to be removed to make it work: (https://www.winhelponline.com/blog/replace-notepad-text-editor-notepad-plus-association/)
I used powershell (admin) commandGet-AppxPackage *Microsoft.WindowsNotepad* | Remove-AppxPackage
to remove Notepad. -
i was facing same issue but now it helps me alot… thanks