Click here to Skip to main content
15,886,806 members
Articles / VS Code
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
5.00/5 (2 votes)
28 Feb 2021CPOL 70K   4  
Open any folder in Visual Studio Code by right client menu context
Many times, we need to open project in Visual Studio Code IDE. This tip will show us the steps to do this efficiently and increase productivity.

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

Image 1

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
India India
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --