65.9K
CodeProject is changing. Read more.
Home

How to Open Folder Directly in Visual Studio Code by Right Clicking in Windows Explorer

starIconstarIconstarIconstarIconstarIcon

5.00/5 (2 votes)

Mar 1, 2021

CPOL
viewsIcon

79554

Open any folder in Visual Studio Code by right client menu context

Introduction

Visual Studio Code is a lightweight code editor and runs on any platform. It is much easier to work with it.

Often, we need to open folder in Visual Studio Code in order to run a project.

So it's easy if there is an option to open any folder directly in Visual Studio Code from Windows Explorer.

We can do it by changing "Right Click Context Menu" registry.

Using the Code

Step 1

Create a file with ".reg" extension

Step 2

Apply the following code...

Note: Change "Code.exe" file path as per your folder directory structure:

Windows Registry Editor Version 5.00

; Open files [HKEY_CLASSES_ROOT\*\shell\Open with VS Code] @="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; This will make it appear when you right click ON a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="Open in VS Code"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"

[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; This will make it appear when you right click INSIDE a folder
; The "Icon" line can be removed if you don't want the icon to appear
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
@="Open in VS Code"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"

[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\"" 

Save the file and close it.

Step 3

Open that file by double click / hit Enter.

It will ask for permission, after that, it will apply a new context to right click in Windows Explorer.

It will save time and improve productivity.

History

  • 1st March, 2021: Initial version