How can I change the editor used to edit batch/command files?
January 8, 2000
A. If you right click on a .bat or .cmd file and select edit the file will be opened in Notepad however you may want to use a different editor as the default.
This can be accomplished by making two small registry modifications
Start the registry editor (regedit.exe)
We will first change the editor used for .bat files.
Move to HKEY_CLASSES_ROOTbatfileshelleditcommand
Double click on the (Default) value and change to the executable you want to use to edit the batch files, e.g. C:Program FilesDevStudioSharedIDEBINmsdev.exe "%1" if you wanted to use Microsoft Development editor. Click OK
We shall now perform the same for .cmd files
Move to HKEY_CLASSES_ROOTcmdfileshelleditcommand
Double click on the (Default) value and again change to the editor to use. Click OK
No reboot is required and any changes take immediate effect
You could also perform the above via a GUI front end by selecting View - Folder options - File Types from Explorer. You could then select the file type, e.g. "MS-DOS Batch file" and click Edit. The context menu options available are listed and you can modify them. All this does is update the registry values we have looked at.
If you wanted to leave the existing option and add a new Edit option, e.g. "Edit with MSDEV" perform the following (in this example we will only update .bat with a second edit option but the same could be performed on cmd):
Start the registry editor (regedit.exe)
Move to HKEY_CLASSES_ROOTbatfileshell
From the Edit menu select New - Key and enter a name of "editms" (don't type the quotes)
Double click on the (Default) value under editms and set the name to be displayed on the context menu, e.g. "Edit with MSDEV", click OK
Select editms and select New - Key from the edit menu and enter a name of "command" (again don't enter the quotes)
Double click the (Default) under command and set to the required value, e.g. C:Program FilesDevStudioSharedIDEBINmsdev.exe "%1" for msdev. Click OK
Close the registry editor
You will now have two options when you right click on a batch file, edit and edit with MSDEV.
Click here to view image
You can use this on any type of file, e.g. txt files by editing HKEY_CLASSES_ROOTtxtfileshellopencommand. Just look through HKEY_CLASSES_ROOTxxxfile where xxx is the extension (actually to find the correct file type use the assoc command, e.g. assoc .txt, it will then return the file type, txtfile).
About the Author
You May Also Like