Change the Default Editor for Batch files in Windows

When you right-click on a Windows batch file (.bat) file and click Edit, Notepad opens the file by default. If you have a Notepad replacement software installed in your system, you can set it as the default editor for Windows batch files.



Change the Default Editor for Batch Files

  1. Launch the Registry Editor (regedit.exe)
  2. Navigate to the following branch:
    HKEY_CLASSES_ROOT\batfile\shell\edit\command
  3. Double-click the (default) value on the right.
  4. By default, it points to notepad.exe. Replace the existing data with the complete path of your editor.
    Example:

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

    Be sure to include the "%1" at the end (with quotes), as mentioned above.

  5. Optionally, to change the default editor for .CMD files as well, then make the change in the following key as well:
    HKEY_CLASSES_ROOT\cmdfile\shell\edit\command
  6. Exit the Registry Editor.

When you right-click on a Windows batch file and choose Edit, your chosen editor will now open the batch file for editing.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

3 thoughts on “Change the Default Editor for Batch files in Windows”

  1. Every time I need to read or edit a BAT file from now on, your tip will have made my day a little bit better. Thank you.

    Reply
  2. Better late than never, thanks for this. This also works for .cmd files if you change the same thing for the ‘cmdfile’ registry entry.

    Reply

Leave a Comment