Add VSCode to Context Menu after Installation

Written by James McDonald

November 15, 2022

Copy and paste the following into a .reg file and change the path to match your system

Double click on the .reg file to insert it into the registry

Windows Registry Editor Version 5.00
;"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe"
;C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe
; This will handle right clicking on a file
 
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
 
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
 
; This will handle right clicking on a folder and open that folder
; as a new project
 
[HKEY_CLASSES_ROOT\Directory\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
 
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\""
 
; This handles the case of right clicking inside of a folder
; to open that folder as a new project
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\""

; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\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:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\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:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Users\\JamesMcDonald\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\""

From the following blog

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Ubuntu on Hyper-v

It boils town to installing linux-azure # as root or sudo apt-get update apt-get install linux-azure...