10

After upgrading to Win 11 a bit over a week ago, I found that my Image File Execution (i.e. HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe) replacement for Notepad was no longer working; all my text files opened in Notepad instead of Notepad2 as it used to in Win 10.

I checked my registry and found that IFE for notepad.exe was still in place. However, text files still opened in notepad. I therefore proceeded to check HKCU\Software\Microsoft\Windows\CurrentVersion\App Paths\notepad.exe and replaced the relevant values with Notepad2, my preferred text application. After that, typing notepad.exe in any terminal window opens Notepad2 but double-clicking text files still opens them in notepad.

My question therefore is, is there any straightforward way to make notepad2.exe (or any other text editor) replace notepad.exe as was possible in earlier versions of Windows?

Toto
  • 17,001
  • 56
  • 30
  • 41
Alex Essilfie
  • 1,385
  • 2
  • 12
  • 23
  • 2
    What about Notepad++ ? – John Oct 18 '21 at 23:49
  • @John No, it doesn't work either except by explicitly setting each file association one by one. Every tutorial for replacing notepad.exe with Notepad++ uses the same registry keys I indicated above. – Alex Essilfie Oct 19 '21 at 00:04
  • Try the steps in this article https://www.ghacks.net/2018/10/22/replacing-notepad-with-notepad-in-windows/ The registry key change is a bit different and might work for you, – John Oct 19 '21 at 00:12

4 Answers4

8

I found that uninstalling the Windows Store Notepad app reverted the Win10 and older behaviour.

Alex Essilfie
  • 1,385
  • 2
  • 12
  • 23
  • It does not seem possible to uninstall Windows Store Notepad app in Windows 11. – Andrew Savinykh Dec 24 '21 at 10:34
  • This works with notepad2, I just created a new shortcut to notepad2.exe – eried Jan 22 '22 at 13:53
  • 4
    Worked for me with, with admin powershell: `Remove-AppxPackage Microsoft.WindowsNotepad_10.2103.6.0_x64__8wekyb3d8bbwe` (to get the fullname, list the packages with `Get-AppxPackage`) – fehrlich Feb 10 '22 at 08:45
  • I managed to uninstall the Store Notepad using the above powershell. Doesn't seem to have made the registry key kick in, though. (Maybe when I reboot?) – mwardm Jun 20 '22 at 15:52
1

Not sure whether this is the solution you want, but as a workaround go to "Default Apps" settings in Win11 and change the default action for the extension .txt to "open with Notepad2". Other extensions also can be changed as required.

deep64blue
  • 105
  • 3
kordell
  • 19
  • 1
1

In additional, set FilterFullPath to your editor.

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"Debugger"="C:\\ProgramData\\scoop\\apps\\notepad3\\current\\Notepad3.exe /z"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\0]
"FilterFullPath"="C:\\ProgramData\\scoop\\apps\\notepad3\\current\\Notepad3.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\1]
"FilterFullPath"="C:\\ProgramData\\scoop\\apps\\notepad3\\current\\Notepad3.exe"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe\2]
"FilterFullPath"="C:\\ProgramData\\scoop\\apps\\notepad3\\current\\Notepad3.exe"
Chino Chang
  • 111
  • 2
1

TLDR

If removing the Microsoft Store Notepad did not help, you can run reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /f as admin to clean up the redirection record completely and then re-install notepad2 that will re-create the record in the desired form.

Details

This problem annoyed me enough, so I decided to dig a bit deeper, user Chino Chang does have a point in their answer.

There is pretty good description of how Image File Execution Options works in the linked article. The salient point is that there is now a UseFilter value under the Image File Execution Options/filename key, and if it is set, then not every notepad.exe will be redirected to yours, but just those that are specified in the subkeys. Since the Microsoft Store one does not seem to be specified it does not get redirected.

Version 6.1 extends the scheme to differentiate according to the whole name that is supplied for the executable. The extension is a little complicated because, of course, the whole pathname can’t itself be a subkey. If the subkey just for the filename contains a particular value (to show that the extension applies) and a suitable subkey (containing a particular value whose string data matches the executable’s whole name), then the function returns the deeper subkey instead. Extension to a subkey for the whole name of the executable applies only if the subkey for the filename contains a REG_DWORD value named UseFilter whose dword of data is non-zero If the UseFilter value is absent from the subkey for an executable’s filename, or if it is present but has the wrong type or size or is zero, then all executables with this filename have the same Image File Execution Options and the subkey for the filename is what the function sticks with. Given that the subkey for just the filename has a correctly configured UseFilter, it may have any number of subkeys that are each for a different pathname. The names of the subkeys are immaterial. What matters is whether a subkey has a REG_SZ value named FilterFullPath whose data matches the executable’s whole name

This was my case, I did have UseFilter and I did have the subkeys with some paths. Getting rid of these resolved the issue.

Note: Notepad store app can be deleted with the following command if required:

Get-AppxPackage | Select-Object -ExpandProperty PackageFullName | Select-String notepad | Remove-AppxPackage
Andrew Savinykh
  • 1,935
  • 3
  • 29
  • 31