Site icon Winhelponline

How to Replace Notepad With Notepad++ or Other Editor

notepad++

If you’re looking at how to replace Notepad with Notepad++ or any third-party editor, this post explains 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.

Notepad is a lightweight 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 many features built-in.

(This article applies to all versions of Windows, including Windows 10/11.)

(Proceed directly to the RECOMMENDED method.)

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 1. This also means that you can’t run Notepad as long as the setting is in effect. This method uses the debugger registry value to redirect a program to another program. Once you redirect a program using this method, when you launch Notepad by running notepad.exe directly or double-click a text file, Notepad++ starts instead of Notepad. This method works in Notepad++ 7.5.9 and higher.

Whereas if you follow Method 2 (which is a traditional file association modification), you can still launch Notepad as usual; you can start Notepad via shortcut, the Run dialog, Open with dialog, etc.

How to Replace Notepad with Notepad++

Method 1

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

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

Run the following command to replace Notepad with Notepad++.

  1. Start an elevated or admin Command Prompt.
  2. Copy the following command, paste it into Command Prompt, and press Enter:
    reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /t REG_SZ /d "\"%ProgramFiles(x86)%\Notepad++\notepad++.exe\" -notepadStyleCmdline -z" /f

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

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

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

    Windows 11 – Additional Steps needed

    Windows 11 comes with the modern/UWP Notepad Store app, which replaces classic Notepad (using the “AppExecutionAliasRedirect” registry setting) by default. To replace Notepad with Notepad++ in Windows 11, you’ll need to restore the classic Notepad, or uninstall the modern Notepad app via Settings → Apps & Features. Also, run the following command-line if required:

    reg add "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /t REG_DWORD /v "UseFilter" /d 0 /f
  3. Close the Command Prompt window.

You’ve now replaced Notepad with Notepad++. Launching text files or running Notepad.exe manually will now start Notepad++.

If you wish to undo (reverse) the changes, use the following command:

reg delete "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\notepad.exe" /v "Debugger" /f

Option 2: Use NotepadReplacer program

NotepadReplacer software from Binary Fortress lets you replace Notepad the easy way! No registry edits are 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, click Next, and click Install.

This program sets the debugger for Notepad automatically, redirecting it to “NotepadReplacer.exe,” a proxy program that in turn starts Notepad++ and passes the file name arguments to it.

Option 3: Using a Custom VBScript

Here is a tiny script that intercepts the file name argument(s) used with Notepad.exe and automatically passes it on to Notepad++. This script can be set as the redirector/debugger for Notepad.exe via the registry.

  1. Open Notepad, copy the following lines, and paste them:
    Set WshShell = WScript.CreateObject("WScript.Shell")
    If wscript.arguments.count <2 then
    	WshShell.run "notepad++.exe"
    Else
    	sCmd = "notepad++.exe " & """" & wscript.arguments(1) & """"
    	WshShell.run sCmd
    End If
    
  2. Save the file as npp.vbs
  3. Move the file to the C:\Windows directory.
  4. Start the Registry Editor and go to:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options
  5. Create a subkey named notepad.exe
  6. Under the notepad.exe key, create a string value (REG_SZ) named Debugger
  7. Double-click Debugger and set its data as follows:
    c:\windows\system32\wscript.exe "c:\windows\npp.vbs"

  8. Then, go to the following key:
    HKEY_CLASSES_ROOT\txtfile\shell\open\command
  9. Double-click (default) and change the value data from:
    %SystemRoot%\system32\NOTEPAD.EXE %1

    to the following:

    %SystemRoot%\system32\NOTEPAD.EXE "%1"
  10. Exit the Registry Editor.

Automate Methods (Options 1 & 3) Using registry files:


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

For many users, simply associating the text files with Notepad++ will be enough. This way, Notepad is not blocked or redirected, and you can open it manually at any time.

  1. Create a sample text document on the desktop.
  2. Right-click on the file and click Properties.
  3. Click the Change button, select Notepad++ from the list of apps shown, and click OK.
    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++ such that every call to Notepad will launch Notepad++, follow one of the three options listed under Method 1.

You can also adopt some of the methods discussed in this article for any other text editor of your choice.

Exit mobile version