Windows 10 - How do I set Visual Studio Code as my default HTML editor?

10,960

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.

Share:
10,960

Related videos on Youtube

Tim G.
Author by

Tim G.

2016 Graduate of Penn State University with a degree in Information Sciences and Technology Currently Employed at Vertex

Updated on September 18, 2022

Comments

  • Tim G.
    Tim G. over 1 year

    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.

    • Admin
      Admin over 6 years
      "Edit HTML File" will be a command registered in the registry for .htm and .html files that points to Dreamweaver. Find these entries and edit them.
    • Admin
      Admin over 6 years
      I think you could right click it, hover over the "open with" option, and then "choose another app" to open it with (if opening from File Explorer). You may need to browse for the application. A text editor should open it up to the HTML text for editing purposes.
    • Admin
      Admin over 6 years
      That is how to open the file with a specific application, but it does not actually answer the question.
  • Ravindra Bawane
    Ravindra Bawane over 6 years
    First, this is Windows 10 which has a different UI. The path you've given ends up opening the default Win10 "Default Apps" window, not the actual "...by protocol" window. Second, the protocol window does not handle file types.
  • Ravindra Bawane
    Ravindra Bawane over 6 years
    Finally, the CORRECT window for File Type association ONLY handles the default application, the one that opens the file when you double-click on it or press your Enter key. It does NOT handle the secondary functions such as Edit.