Tuesday, August 23, 2022

How to configure option open in VS code on mouse right click in windows

 Create a file with extension as .reg let say we created a file as addVscode.reg and put the belwo code in it.

addVscode.reg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\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 Folder as VS Code Project"
"Icon"="\"C:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\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 Folder as VS Code Project"
"Icon"="\"C:\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Microsoft VS Code\\Code.exe\" \"%V\""

Finally execute the file directly on double clicking on it. system will ask to add this to registry and say yes.
Finally you will be able to see the option to open the folder in VS code as shown below.

Note:- Please make sure to give the proper path of your Code.exe by defult if store in programe file but change it accordingly if you have installed in other folder as in my case i had installed VS code in C:\Microsoft VS Code\Code.exe\

No comments: