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
- Launch the Registry Editor (
regedit.exe
) - Navigate to the following branch:
HKEY_CLASSES_ROOT\batfile\shell\edit\command
- Double-click the
(default)
value on the right. - 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. - 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
- 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.