How to set Visual Studio Code as your default editor

The more I use Visual Studio Code the more I want it to be my default editor for more file types. Although Visual Studio Code adds a convenient “Open with Code” option to the context menu I just want to double click a file and have it opened with Visual Studio Code.

To make Visual Studio Code the default program for a file type you first have to locate the exe. But search as much as you like but you will not find code.exe under %ProgramFiles%. Visual Studio Code is stored under your user folder C:\Users\{YourAccount}\AppData\Local\Code. Once you locate the folder you may notice multiple app-0.1.x folders. So which do you associate with your files? I would recommend none of them. Visual Studio Code updates itself and appears to create a new folder. So to make sure you are always pointing at the latest version you are better off using the cmd file in the bin folder.

You can follow the steps below to make Visual Studio Code your default editor for any text based file type. The steps below show you how I did it for .json files.

First find the file type for which would like to have Visual Studio Code be your default editor. You can right click on it and select “Choose default program…”.

Or you can select “Properties” and click the “Change…” button.

On the dialog that opens click the “More options” link.

Then click on “Look for another app on this PC”.

Now browse to C:\Users\{YourAccount}\AppData\Local\Code\bin and select code.cmd.

Now when you double click a file of that type it will be opened with Visual Studio Code.

Comments (1) -

  • Hey Donovan
    thanks for this article! but know what? the problem is, that now every double click on a file opens a new instance of VS Code (instead of open the file in the same window). they say, they solved it in 0.5.0, but it doesn't seem to work properly :-(

Add comment

Loading