13

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.

22

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

  • Run RegEdit.
  • 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.

  • @MarkDuncan That's not really an alternative way to assign Notepad++ to the R-Click -> Edit menu entry. ;) – Ƭᴇcʜιᴇ007 Mar 6 '15 at 15:53
  • @Techie007 - No it's a quick and easy way without the need to rewrite any registry entries. I came here looking for the same solution(edit with another program) but then realised drag and drop would be sufficient. – Mark Duncan Mar 7 '15 at 11:49
  • Used to do this, but it's not working after win8. Is there any way to do this in win8 / win10 ? Btw I'm using notepad2. In win8/win10, it will show "windows can't open this type of file (.cmd / .bat)" – Tiw Jul 2 '17 at 8:48
  • @POW Just did it in Win 10. Working correctly, no errors. – fredsbend Oct 27 '18 at 0:44
  • 1
    I had to put quotation marks around %1 to make it work with file paths with spaces: "%1" – Peter Wood Nov 21 '18 at 9:23
0

If there are spaces in the filename being edited then "" can be added as : "C:\Program Files (x86)\Notepad++\notepad++.exe" "%1"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.