0

I have a habit of doing the following:

win-key notepad

whenever I have to jot down a quick note.

In previous versions of windows, I would just kill notepad.exe to close all those windows.

Now, in Windows 11, all those notepad.exe windows stick around.

taskkill.exe

The recommended approach of:

taskkill.exe /F /im notepad.exe

as mentioned in this post:

How to close all notepad instances in a single close operation

doesn't work; if I run notepad, all the windows come back.

'Close all windows`

If I right click on the notepad icon on the taskbar and select 'Close all windows':

enter image description here

I get a bunch of confirmation dialogs:

enter image description here

Question

What's a good way to close all the notepad windows?

3
  • ...doesn't work; if I run notepad, all the windows come back.", what do you mean by the windows come back? Commented Mar 10 at 9:37
  • 1
    @ReddyLutonadio: Under Windows 11 after taskkill.exe, the first invocation of notepad brings up all the killed windows with their content. The windows need to be closed, which means the user has to click "Don't save" for each. Just another bright idea by Microsoft.
    – harrymc
    Commented Mar 10 at 9:54
  • why don't just use dedicated Notes apps? They can be mapped to a global shortcut key and have much more features. For example OneNote maps to Win+N, Win+Shift+N or Win+Alt+N
    – phuclv
    Commented Mar 12 at 3:56

2 Answers 2

1

To return to the old behavior of notepad, you need to uninstall the new UWP implementation of notepad. This will make it possible to use the old notepad from Windows 10, as it's still found in C:\Windows\System32. You will need to ignore the message about a newer version.

This is discussed in detail in the article How to Restore Old Classic Notepad in Windows 11. Below is a summary of the methods:

Method 1: Disable the Notepad App execution alias

  • Open Settings > Apps > Advanced app settings
  • Click "App execution aliases"
  • Find "Notepad" in the list and turn off the radio button.

The effect is immediate.

If Microsoft has removed notepad.exe from C:\Windows\System32, you might be able to return it by the following two methods.

Install the classic Notepad program via Optional features

  • Open *Settings > System > Optional features"
  • Click "View features"
  • Type notepad
  • Click install Select Notepad (system) from the list, and click Next.

Using the DISM command-line to install Classical Notepad

  • Run and elevated CMD and enter this command :

    dism /Online /add-Capability /CapabilityName:Microsoft.Windows.Notepad.System~~~~0.0.1.0
    

Method 2: Restore Classic Notepad via the registry

Execute this .reg file :

Windows Registry Editor Version 5.00

;Restore Old Classic Notepad on Windows 11
;Created by Ramesh Srinivasan for Winhelponline.com
;Created on May 6, 2022; Revised on May 12, 2022.

[HKEY_CLASSES_ROOT\Applications\notepad.exe]
"NoOpenWith"=-

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\App Paths\notepad.exe]

[HKEY_CLASSES_ROOT\txtfilelegacy\DefaultIcon]
@="imageres.dll,-102"

[HKEY_CLASSES_ROOT\txtfilelegacy\shell\open\command]
@="C:\\Windows\\System32\\notepad.exe \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe]
"UseFilter"=dword:00000000
4
  • Amazing answer, thank you Harry!
    – dharmatech
    Commented Mar 12 at 2:35
  • Hey Harry! Yup, your answer is very helpful and insightful. I also like the approach provided by @1NN in another answer. It seems straightforward and seems to work well. What do you think about that approach?
    – dharmatech
    Commented Mar 13 at 14:38
  • 1
    @dharmatech: I don't like to talk against answers by others. My personal approach is not to modify folders created by Windows software, also because they may return, but sometimes it's necessary.
    – harrymc
    Commented Mar 13 at 14:48
  • Harry, I totally understand. 👍Thank you! 🙂
    – dharmatech
    Commented Mar 14 at 15:16
1

After taskkill, delete the subfolders and contents of the following folder:

  %localappdata%\Packages\Microsoft.WindowsNotepad_8wekyb3d8bbwe\LocalState\

The 8wekyb3d8bbwe part could be different on your system.

This will delete all autosaves and tab states, so afterwards a clean notepad will open.

It should be easy to wrap both commands into a batch file.

1
  • Works great, thank you!
    – dharmatech
    Commented Mar 13 at 14:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .