Windows 10 – How to set Visual Studio Code as the default HTML editor

visual-studio-codewindows 10

Chrome is set as my default browser and it opens .htm files by default.

However, when I right-click an .htm file to open it for editing, Dreamweaver launches and opens the file.

How do I set Visual Studio Code as my default editor? I'm using Windows 10. I'm not sure where to change that.

Best Answer

Open Regedit as Administrator on your computer.

In HKCR find the .html and .htm entries and check the (Default) value. They should both be "htmlfile". But if they aren't, note the value and use it in place of htmlfile for the remainder of this process.

Next, find htmlfile further down the same list of entries under HKCR (hint: use type-to-search in the registry), and expand the Shell key.

This will now show the default options available for file extensions associated with the filetype htmlfile, as well as the programs associated with each option. The normal list of keys under Shell will be Edit, open, Print, and printto. The Default option, the one that occurs when you double-click files of that type, is noted in the (Default) value under the Shell key; normally this is open.

Now that you've found the Edit key under HCKR\htmlfile\Shell, you can modify this to point to Visual Studio Code.

Expand the command key and observe the (Default) value. It probably has the path to the Dreamweaver executable in double quotes, followed by a %1. Double-click on (Default) to edit this value, and change the path in quotes to the VSCode executable, making sure to leave the quotes, the spaces, and the %1 afterwards.

Once you click OK the settings are applied, so you can try right-clicking on a .htm/.html file and selecting Edit. If you've entered the path to VSCode correctly, the file should open in that editor.

Related Question