How to make notepad++ the default editor for a Windows batch file?

In Windows, if you right-click a .bat file, there's an "Edit" option, which opens the .bat file with notepad. How do I make Windows use Notepad++ instead?

Note that this is different from the question How do I set Notepad++ as the default editor?. In that question, user asks for a way to make Notepad++ the default opener for specific file types. This is not what I want here, since I expect that double-clicking on .bat files executes them.


Solution 1:

Change the program associated to the "Edit" verb for batch files:

  • Run RegEdit (as admin)
  • Navigate to HKEY_CLASSES_ROOT\batfile\shell\edit\command.
  • Modify the Default and change Value Data from %SystemRoot%\System32\NOTEPAD.EXE %1 to "C:\Program Files (x86)\Notepad++\notepad++.exe" "%1"
  • Close RegEdit.
  • Right-click -> "Edit" should now open batch files in NotePad++.

Note: You may have to adjust your path to Notepad++.exe if it resides in a different folder on your system.

Also note: This is a system-wide change.

Solution 2:

If there are spaces in the filename being edited then double-quotes (") can be used to surround the argument. For example:

"C:\Program Files (x86)\Notepad++\notepad++.exe" "%1"