Replace windows notepad with notepad

Notepad2 ― Replacing Windows Notepad

Note: This document explains the technical details how to replace Windows Notepad with Notepad2. As of Notepad2 version 4.2.25, the Notepad2 Setup Tool takes care of this task, and it’s no longer necessary to manually perform the steps outlined below.

Some usage notes to the setup tool can be found in the Notepad2 FAQ: How to use the Notepad2 Setup Tool to install and update Notepad2?

Kai Liu has introduced support for replacing Windows Notepad using a clean, unintrusive registry-based method with his modified version of Notepad2.

Replacing Windows Notepad with Notepad2

Replacing Windows Notepad with Notepad2 can be a little tricky since notepad.exe is a protected system file, which makes a direct replacement a bit difficult (though not impossible).

There is an easier way to replace Windows Notepad by using the «Image File Execution Options» registry key to trick Windows into running notepad2.exe whenever notepad.exe is run. This same trick is used by the «Replace Task Manager» function in Microsoft’s Process Explorer. The benefit to using this method to replace Notepad is that you will not run afoul of Windows File Protection (since you are not actually replacing the executable itself), and you can undo it at any time by simply deleting the registry key. The downside to this method is that it does not work properly with the official Notepad2 build; there are a few minor changes that need to be made to Notepad2 in order for this to work (see my img_exec_replace patch).

In order to use this method of Notepad replacement, you will need to follow these steps:

  1. Obtain a build of Notepad2 that supports this form of Notepad replacement.
  2. Create the following registry key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe.
  3. Inside the key, create a new string (REG_SZ) value, named «Debugger».
  4. Set the data of this new «Debugger» value to the full path to the Notepad2 executable, followed by the /z switch. For example, "C:\Windows\Notepad2.exe" /z

Simon Steele describes the same procedure for his text editor Programmer’s Notepad, and also explains which registry key to use on 64-bit Windows, in case you’re using a 32-bit version of Notepad2 on 64-bit Windows.

HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\Image File Execution Options

Replacing Windows Notepad with Notepad2 4.1.24 (or newer)

As of version 4.1.24, the official release of Notepad2 supports this method for replacing Windows Notepad, so the steps outlined above will work fine. However, there’s no support to perform the Notepad replacement automatically, as the official release of Notepad2 will not modify the system registry. For the same reason, there’s no support for accessing recent files through the Windows 7 jump lists, by default (this requires registration of applications in the system registry, first).

Читайте также:  Wifi сканер для linux

Also be aware that automated Notepad replacement could have undesirable effects if Notepad2 was used as a Notepad replacement from a portable device, and the original state was not restored when disconnecting the device.

A batch script to run from the Notepad2 directory and replace Windows Notepad might look like this (requires elevated privileges):

The Windows Notepad can be restored with this command (requires elevated privileges):

Enable Jump List Support

A few more tweaks are needed to enable recent file access through the jump lists introduced with Windows 7. First, register Notepad2 as an «Open with» handler using the following batch script (run from the Notepad2.exe directory with elevated privileges):

Next, apply the following changes to the Notepad2.ini file:

Recent files now appear in the jump lists. Notepad2 windows are now assigned to a custom AppUserModelID, that’s why multiple icons may appear if Notepad2.exe is directly pinned to the taskbar. To fix this, open a Notepad2 window first, and then pin it to the taskbar from the Notepad2 taskbar button context menu.

Unregister the Notepad2 «Open with» handler with the following script (requires elevated privileges):

В© Florian Balmer 1996-2014
Page last modified: July 01, 2011

Replace windows notepad with notepad

Этот документ раскрывает технические детали процесса замены стандартного текстового редактора Windows Notepad на более продвинутый, который любят многие программисты — на Notepad2. Поскольку Notepad2 версии 4.2.25 имеет программу установки, которая сама делает такую замену, то больше нет необходимости вручную проводить шаги, описанные ниже [1].

Некоторые замечания по программе установки можно найти в Notepad2 FAQ [2], см. вопрос «Как использовать утилиту установки (Notepad2 Setup Tool) чтобы установить и обновить Notepad2?».

Со своей модифицированной версией Notepad2 [3] Kai Liu представил поддержку замены Windows Notepad с использованием чистого, не разрушающего работу системы метода, основанного на реестре.

[Замена Windows notepad на notepad2]

Процедура замены может показаться немного сложной, поскольку notepad.exe является защищенным системным файлом, что усложняет его прямую замену (однако замена все же возможна).

Самый простой способ замены — использовать ключ реестра «Image File Execution Options», чтобы заставить Windows запускать notepad2.exe всякий раз, когда раньше должен был бы запускаться notepad.exe. Тот же самый трюк используется и в функции «Replace Task Manager» программы Microsoft Process Explorer [4]. Выгода этого метода в том, что замена стандартного Notepad не запутывается системой защиты системных файлов Windows File Protection — потому что на самом деле Вы не заменяете никакой исполняемый системный файл на диске. Программа notepad.exe остается в целости и сохранности на своем старом месте, и Вы можете легко откатить обратно сделанные изменения, просто удалив этот ключ реестра. Недостаток этого метода в том, что он не работает правильно с официальной сборкой Notepad2; есть несколько незначительных изменений, которые нужно сделать для Notepad2 для работы этой функции (см. авторский патч img_exec_replace).

Для использования этого метода замены Notepad Вам нужно выполнить следующие шаги:

1. Получите сборку Notepad2, которая поддерживает эту форму системной замены Notepad.

2. Создайте ключ (раздел) реестра HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe.

3. Внутри этого ключа реестра создайте новое строковое (REG_SZ) значение под именем «Debugger».

4. Установите данные этого нового значения «Debugger» в значение полного пути до исполняемого файла Notepad2, за которым идет опция /z, например:

Simon Steele описывает ту же процедуру для своего текстового редактора Programmer’s Notepad [5], и также объясняет, какой ключ реестра использовать на 64-битной версии Windows, когда Вы используете 32-битную версию Notepad2 на 64-битной версии Windows.

Читайте также:  Журнал событий windows проблема

[Замена в случае Notepad2 версии 4.1.24 (или более новой)]

Поскольку начиная с версии 4.1.24 официального релиза Notepad2 поддержка этого метода замены стандартного Windows Notepad уже предусмотрена, то описанные выше шаги работают нормально. Однако в этих версиях нет автоматической поддержки замены Notepad, так как официальный релиз Notepad2 не модифицирует реестр системы. По той же причине нет поддержки доступа по умолчанию к последним используемым файлам через списки перехода Windows 7 (потому что это требует предварительной регистрации приложений в системном реестре).

Также избегайте использование автоматической замены Notepad при запуске с извлекаемых носителей (например флешка), поскольку это может дать нежелательные эффекты, если программа Notepad2 запускалась не с фиксированного места положения на диске — оригинальное состояние не будет восстановлено, если извлечено устройство, с которого был осуществлен запуск.

Скрипт командного файла для запуска из директории Notepad2 и замены Windows Notepad может выглядеть следующим образом (это требует повышенных административных привилегий):

Оригинальный Windows Notepad может быть восстановлен следующей командой (также требуются права администратора):

[Как добиться поддержки списка последних изменяемых файлов]

Требуется провести несколько дополнительных настроек, чтобы работала стандартная функция списка доступа к последним изменяемым файлам (recent file access) через списки перехода (jump lists), представленные в Windows 7. Сначала зарегистрируйте Notepad2 как обработчик «Open with» с использованием следующего командного файла (его нужно запустить из каталога установки Notepad2.exe с повышенными привилегиями):

После этого сделайте следующие изменения в файле Notepad2.ini:

После этого «Recent files» появятся в jump lists. Окна Notepad2 теперь присвоены пользовательскому AppUserModelID, и из-за этого могут проявиться несколько иконок, если Notepad2.exe непосредственно прикреплен к панели задач (taskbar). Чтобы исправить это, сначала откройте окно Notepad2, и затем привяжите его к панели задач с помощью кнопки контекстного меню Notepad2 на панели задач.

Отмена регистрации для Notepad2 обработчика «Open with» делается следующим скриптом (требуются повышенные административные привилегии):

How to Replace Notepad With Notepad++ or Any Other Text Editor?

Notepad is a light-weight program suitable for users who need only very minimal text editing features. For additional features and functionalities, third-party editors like Notepad++ and Sublime Text are awesome with a lot of features built-in.

If you’re looking how to completely replace the plain old Notepad with Notepad++ or any third-party editor, this post tells you how to do it. Notepad++ is a free source code editor and Notepad replacement that supports several languages. Let’s see how you can replace Notepad with Notepad++ without replacing any system files.

How to Replace Notepad with Notepad++ in Windows?

Which of the Methods below should you use?

If you want Notepad++ to open whenever you double-click a text file, and whenever notepad.exe is executed, follow one of the options under Method 2 . This also means that you can’t run Notepad as long as the setting is in effect.

Whereas if you follow Method 1, you can still launch Notepad by mentioning its full path in Run dialog. You can also open a file with Notepad by choosing Notepad from Open with dialog.

Method 1: Associate Text Files (.txt) with Notepad++

  1. Create a sample text document on the desktop.
  2. Right-click on the file and click Properties.

Click the Change button, select Notepad++ from the list of apps shown, and click OK.

Читайте также:  Как получить список процессов windows

If Notepad++ isn’t listed there, click “More apps” to show the extended list. Notepad++ may not be listed there if you’re using the portable edition. If so, click “Look for another app on this PC” and manually browse the Notepad++ folder to select the executable. The default Notepad++ executable path is C:\Program Files (x86)\Notepad++\notepad++.exe

Double-clicking .txt files will now open Notepad++.

Changing the file association is sufficient for most users. However, if you want to completely replace Notepad with Notepad++ so that every call to Notepad will launch Notepad++, follow one of the options listed under Method 2.

Method 2: Replace Notepad with Notepad++ Using Debugger Registry Value

Windows provides a way to redirect a program (process) using the debugger registry value. Once you redirect a program using this method, every time you launch Notepad by running notepad.exe directly, or when running a text file, Notepad++ starts instead of Notepad.

Option 1: Using Notepad++’s new command-line

Note: This is the RECOMMENDED method. It doesn’t need a 3rd party program or script.

If you have Notepad++ version 7.5.9 and higher, you can run the following command to make Notepad++ replace Notepad.

  1. Start an elevated or administrator Command Prompt
  2. Copy the following command and paste it in the Command Prompt window:

Note that you may need to use “ %ProgramFiles%\Notepad++\ ” to substitute for “ %ProgramFiles(x86)%\Notepad++\ ” if you have Notepad++ 64-bit installed, or use other path if your Notepad++ is installed in a non-default location.

After running the command, this is how the debugger registry value looks like:

You can also modify the above registry value using the Registry Editor ( regedit.exe ) if you don’t prefer the command-line method.

To undo (reverse) the replacement, use the following command:

  • Close the Command Prompt window.
  • Option 2: Use NotepadReplacer program

    NotepadReplacer software from Binary Fortress lets you replace Notepad the easy way! No registry edits needed; the program does that automatically.

    Download the NotepadReplacer program and run it.

    Choose the Notepad alternative (say, Notepad++) by browsing and selecting the executable, and complete the steps.

    This program sets the debugger for Notepad automatically, redirecting it to “NotepadReplacer.exe”, a proxy program which then launches Notepad++ and passes the file name arguments to it.

    Option 3: Using a Custom Vbscript

    Here is a script method written a long time back and still works. This tiny script intercepts the file name argument(s) used with Notepad.exe, and pass it on to Notepad++ automatically.

    1. Open Notepad, copy the following lines and paste them:
    2. Save the file as npp.vbs
    3. Move the file to C:\Windows directory.
    4. Start the Registry Editor and go to:
    5. Create a subkey named notepad.exe
    6. Under notepad.exe key, create a string value (REG_SZ) named Debugger
    7. Double-click Debugger and set its data as follows:
  • Then, go to the following key:
  • Double-click (default) and change the value data from:

    to the following:

  • Exit the Registry Editor.
  • Automate Methods Using REG files

    Download replace-notepad.zip, unzip and run the appropriate REG file. There is also an undo.reg file provided if you want to reverse the changes made.

    That’s it! Hope one of the methods above helped you replace Notepad with Notepad++. The methods can also be adopted for any other text editor of your choice.

    Оцените статью