Notepad++ Default Editor – How to Set for Windows Batch Files

notepadwindows

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.

Best Answer

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.

Related Question