Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add "Open with Visual Studio Code" shortcut to right click menu

Step 1: Open Run and Access the Registry Editor

Opening Registry Editor

Step 2: Navigate to the Following Directory in the Registry Editor

Navigate to Directory

Computer\HKEY_CLASSES_ROOT\Directory\Background\shell

Step 3: Create a New Key

Create New Key in Shell

Setting Up the Name and Icon of the Shortcut:

Values

  • (Default): "Shortcut Name" (e.g., "Open with Visual Studio Code")
  • Icon: "Shortcut Icon" (Path to the icon, e.g., "Path to Code.exe in the example")

Command:

Creating Command

Create a new key in your directory and set the "(Default)" value to the command.

  • (Default): "Path to Visual Studio Code" "."

This is not a question but rather a guide on how to add the "Open with Visual Studio Code" option to the right-click menu.

like image 875
Dfr Avatar asked Sep 14 '25 00:09

Dfr


2 Answers

For those who are new to the Registry Editor, here's an additional note for Step 3:

  1. Double-click on the (Default) key to open a popup.
  2. Enter your value there.

If you're entering "Open with Visual Studio Code," that's fine. However, if you're entering a path, remember to wrap your path in double quotes, as shown in the example above.

For instance, my icon value is:

"C:\Users\PACKARD BELL\AppData\Local\Programs\Microsoft VS Code\Code.exe"

And my command value in the command key is:

"C:\Users\PACKARD BELL\AppData\Local\Programs\Microsoft VS Code\Code.exe" .

Notice that with the command value here, we have the path wrapped in double quotes, as well as white space and a dot wrapped in double quotes.

like image 153
codeBreak Avatar answered Sep 15 '25 13:09

codeBreak


If you not want/know edit regedit code, you can create/download file with extension .reg . Link for template .zip Content this file:

Windows Registry Editor Version 5.00

; Add "Open with Code" to the context menu for files/directory/directory background/drive.

[HKEY_CLASSES_ROOT\*\shell\VSCode]
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"
@="Open w&ith Code"

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

[HKEY_CLASSES_ROOT\Directory\shell\VSCode]
@="Open w&ith Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"

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

[HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode]
@="Open w&ith Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"

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

[HKEY_CLASSES_ROOT\Drive\shell\VSCode]
@="Open w&ith Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe"

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

You need change Path to installed VSC on your PC...Example for first lines:

[HKEY_CLASSES_ROOT\*\shell\VSCode]
"Icon"="D:\\Soft\\Microsoft VS Code\\Code.exe"
@="Open w&ith Code"

You need launch this file with .reg extension and Agree change registry.

like image 41
Gray Avatar answered Sep 15 '25 12:09

Gray