194

Just installed Visual Studio Code 1.1.1 on a Windows 7 machine. When I right-click on a folder, "Open With Code" does not appear.

enter image description here

1
  • 2
    Please edit this post so that it asks a question. It is currently impossible to decide which answers to upvote because I cannot tell which are answering the (assumed) question properly.
    – Nate T
    Commented Aug 5, 2020 at 13:17

28 Answers 28

211

Copied from Right click on Windows folder and open with Visual Studio Code

  • Create file vsCodeOpenFolder.reg with this content (If you didn't choose the default installation path then you need to adjust the paths in this file):

     Windows Registry Editor Version 5.00
     ; Open files
     [HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
     @="Edit with VS Code"
     "Icon"="C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe,0"
     [HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
     @="\"C:\\Program Files (x86)\\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:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0"
     [HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
     @="\"C:\\Program Files (x86)\\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:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0"
     [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
     @="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"%V\""
    
  • Double click it to create the registry entries.

  • If the "Open with Code" doesn't appear in the Explorer's context menu then you should restart your system.

  • If you're running the 64-bit or Insiders version of VS Code, change the path accordingly. ie. C:\\Users\\[user_name]\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe

15
  • 4
    I've never been able to get this to work under a user account. But it works for admin accounts.
    – CalvinDale
    Commented Apr 18, 2017 at 2:54
  • 7
    @wosi how can we delete the option if needed?
    – AmiNadimi
    Commented May 26, 2017 at 10:06
  • 4
    Now that Code 64-bit is available, this works just as well replacing all occurrences of " (x86)" with "". Or in other words, change "Program Files (x86)" to "Program Files". Commented Mar 12, 2018 at 23:42
  • 3
    For those transferring this for other use cases: The difference between the context menues HKEY_CLASSES_ROOT\Directory\shell\vscode and HKEY_CLASSES_ROOT\Directory\Background\shell\vscode is weather you click on a certain dictory or on "nothing" (you're always in a directory in win explorer)
    – Cadoiz
    Commented Dec 20, 2020 at 19:19
  • 2
    Even the given source states "It’s easier to simply re-install VS Code.": These options are in the installation process
    – eddow
    Commented Jul 14, 2022 at 15:27
159

When installing (or reinstall and) check all checkBoxes especially:

Add "Open with Code" action to Windows Explorer file context menu
Add "Open with Code" action to Windows Explorer directory context menu

install vscode

5
  • 13
    Re-installed and made sure to check the options - fixed for me Commented Mar 9, 2018 at 9:32
  • @ar This works if you are logged-in as an admin user--it doesn't work if you are not in the administrators group (good practice for security reasons).
    – simonl
    Commented May 15, 2018 at 10:37
  • 25
    good thing is you can simply install over it, no need to first uninstall!
    – Kamran Kia
    Commented Nov 4, 2020 at 15:21
  • 1
    Unfortunately for me, my workplace deploys VSCode via Software Center, so the settings are already chosen for me.
    – Sildoreth
    Commented Aug 7, 2023 at 19:13
  • 4
    I reactivated an 11 year old stack exchange account to upvote this
    – pjm56
    Commented Nov 8, 2023 at 0:03
48

In my case, I just re-run the vscode setup and marked all checkboxes as checked and It worked.enter image description here

2
  • 3
    This is exactly the recommended way to do it. Commented Nov 21, 2021 at 20:36
  • 1
    Yeah, don't both with the Regedit solution, this one takes about 1 minute to do.
    – Ben Power
    Commented Jan 25, 2023 at 5:57
43

Here comes the version of file provided by Cockney Rhyming Jedi before suitable for use with 64-bit version of Visual Studio Code:

Windows Registry Editor Version 5.00
; Open files
[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_CURRENT_USER\Software\Classes\*\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_CURRENT_USER\Software\Classes\Directory\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CURRENT_USER\Software\Classes\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_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""
5
  • Obviously integrated updater tends to remove this patch occasionally, so I have to re-apply it after upgrading VS code. Commented Oct 22, 2017 at 15:29
  • 1
    After using this version I did get the new option "Open folder as VS Code project" - but no simple "Open in VS Code". What am I'm doing wrong here?
    – JonSnow
    Commented Dec 15, 2021 at 11:11
  • 2
    @JonSnow you can simply change the text present after @= to whatever you like. Instead of @="Open Folder as VS Code Project", you can say @="Open with JonSnow's Editor" ..lol
    – askids
    Commented Jan 8, 2022 at 20:08
  • 1
    I notice this version updates HKEY_CURRENT_USER, as opposed to HKEY_CLASSES_ROOT in Wosi's answer. Does that mean using this version you could make the registry changes without being a member of the local administrator's group on the machine?
    – Simon Elms
    Commented Sep 11, 2023 at 23:08
  • 1
    @SimonElms I'd assume so. This root key and its thread is writable by current user. Commented Sep 14, 2023 at 18:26
33

If you have vscode installed already and you want the "open with code" option.

Just download vscode from the official website... here!

Run the installer with the option "open with code" checked.

It will update the existing vscode install with the "open with code" option.

4
  • 2
    This option should be the top answer! Commented Aug 28, 2022 at 10:47
  • I think reinstalling the vscode is the best answer. Adding reg data possibly gone wrong
    – Yohanes AI
    Commented Apr 18, 2023 at 10:17
  • what if I don't have admin accesS? Commented Dec 6, 2023 at 5:25
  • @HarshaBiyani The standard VS code installer just targets your user which often doesn't require admin to install
    – Dan
    Commented Jun 19 at 9:58
27

I'd like to add that, many would like to go for the Registry method because they are afraid they might loose all their settings. Just re-download(if you don't already have the download file ) and reinstall. When reinstalling, tick

Add "Open with Code" action to Windows Explorer file context menu
Add "Open with Code" action to Windows Explorer directory context menu

as already said in other answers. Your settings will remain intact. In fact, when it launches, it launches with your working directory as if you never uninstalled it.

3
  • Well, I've tried this so many times for months but that never made it work for me as this option was ticked and still it doesn't add those options to my context menu, but the context menu of admin user I was required to switch to for installation, only. You are missing an essential point of this problem. In addition I don't think people going to patch registry are considering uninstalling some software might drop its settings implicitly. Commented Oct 22, 2017 at 15:27
  • 1
    I don't really get your comment but to elaborate on my answer further, what I'm trying to say is that, maybe someone would like to choose to tweak the settings in the Registry because they might think that, uninstalling their VS code will restore their custom settings to default after they reinstall. My answer is an assurance that, if you uninstall and reinstall the program, your settings will still remain intact.
    – Alf Moh
    Commented Oct 22, 2017 at 15:41
  • 1
    You don't even have to uninstall. Just download the installer, run it and it installs on top of the existing installation. I think it's the uninstall that people are afraid of. I just did this a few minutes ago and it works; all settings and plugins intact.
    – MSOACC
    Commented Oct 9, 2020 at 19:13
23

my vscode installed here:

C:\Users\saber\AppData\Local\Programs\Microsoft VS Code\code.exe

should replace SABER with your pc username

enter image description here

so the script is s.th like this:

save this content as a *.reg file

then run it :

Windows Registry Editor Version 5.00

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

add visual studio code to right click folder in windows

replace the \\saber\\ with \\YOUR_PC_USER_NAME\\

3
  • use your folder name instead of saber in this file Commented Sep 23, 2020 at 16:25
  • 2
    This path of vs code is when you install from Microsoft store. Commented Jul 15, 2022 at 9:35
  • 1
    This path of vscode is also used when you install it using winget as in winget install vscode --silent Commented Apr 12 at 6:10
19

These settings are normally stored per-user for VS Code.

To set for a new user account: re-run the installer.

16

NB: This is for the 32-bit version, for the 64-bit version see Cepharum's answer.

Slight change to the previous answer to allow non Admins to get the functionality in their context menus:

  • Create file vsCodeOpenFolder.reg with this content (If you didn't chose the default installation path then you need to adjust the paths in this file):

    Windows Registry Editor Version 5.00
    ; Open files
    [HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code]
    @="Edit with VS Code"
    "Icon"="C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe,0"
    [HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code\command]
    @="\"C:\\Program Files (x86)\\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_CURRENT_USER\Software\Classes\Directory\shell\vscode]
    @="Open Folder as VS Code Project"
    "Icon"="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0"
    [HKEY_CURRENT_USER\Software\Classes\Directory\shell\vscode\command]
    @="\"C:\\Program Files (x86)\\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_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode]
    @="Open Folder as VS Code Project"
    "Icon"="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0
    [HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode\command]
    @="\"C:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"%V\""
    
  • Double click it to create the registry entries

  • If the "Open with Code" doesn't appear in the Explorer's context menu then you should restart your system.

Essentially I have replaced HKEY_CLASSES_ROOT with HKEY_CURRENT_USER\Software\Classes

1
  • 1
    Thanks for this fix. Glad to see I'm not the only one trying to work with administrative privileges as little as possible. Commented Aug 13, 2017 at 23:39
12

None of the registry entries above worked for me with a standard (non-admin) user account.

I then inserted all the keys into HKEY_LOCAL_MACHINE and then it worked!

Windows Registry Editor Version 5.00

; when you right click a file
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\VSCode]
@="Open with Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

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

; when you right click a folder
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; when you right click a folder while holding shift
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

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

; when you right click the background, not on a particular file or folder.
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\LibraryFolder\Background\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\LibraryFolder\Background\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""
9

If you prefer using the keyboard more than the mouse. This solution is for you...

Type the following commands in your file explorer (location).

Open a project

vscode://file/{full path to project}/

vscode://file/c:/myProject/

vscode:// --opens vscode for current directory

Open a file

vscode://file/{full path to file}

vscode://file/c:/myProject/package.json

Open a file to line and column

vscode://file/{full path to file}:line:column

vscode://file/c:/myProject/package.json:5:10

Source: https://code.visualstudio.com/docs/editor/command-line

Example:

enter image description here

9

Reinstall Visual Studio Code from the official website, There won't be any data loss.

Just make sure this time to enable those options in the installer:

enter image description here

It just adds the "Open with Code" option after right-clicking in/on the folder.

But if still doesn't appear:

enter image description here

You just need to click on "Show more options" Or shortly with combination of keyboard stroke Shift + F10:

enter image description here

8

Just run the installer again with open in file explorer option selected. You'll be all set.

Don't worry about the files already opened in vsCode, none of them will be changed

7

if you have windows 11, don't want to mess up with the registry and don't want to wait for the next updates, just hold down shift while right clicking on a folder or file.

1
  • This is an underrated comment. Thanks. Commented Jan 24 at 11:58
5

Paste the code below and save with .reg extension

Windows Registry Editor Version 5.00 ; Open files

[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code] @="Edit with VS Code" 

"Icon"="C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\Code.exe,0" 

[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code\command] 

@="\"C:\Users\hp\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_CURRENT_USER\Software\Classes\Directory\shell\vscode] 
@="Open Folder as VS Code Project"

"Icon"="\"C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\Code.exe",0"

[HKEY_CURRENT_USER\Software\Classes\Directory\shell\vscode\command]

@="\"C:\Users\hp\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_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode]

@="Open Folder as VS Code Project"

"Icon"="\"C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\Code.exe",0

[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode\command]

@="\"C:\Users\hp\AppData\Local\Programs\Microsoft VS Code\Code.exe" \"%V\""

Then press the Windows key, locate Visual Studio Code, then right click and open file the location:

open vscode location

Right click and click Properties, then copy the file path.

enter image description here

Open regedit:

reg edit

For each of the following, double click on the icon, and paste the file path you copied from above:

[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code]
[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code\command]
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\vscode]
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\vscode\command]
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode]
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode\command]

enter image description here

2
  • 1
    There were severe formatting issues with your RegEx file and locations that would have prevented this from working. Notably, your *.reg file had > at the beginning of each line, and had contents wrapped in a way that I believe would have caused issues on import. Further, your registry paths were really inconsistent, with some using > or even --> as the path delimiters. I've updated this to help prevent these issues; please review my changes carefully to make sure they capture your intent. In the future, though, please put more care into your formatting and code to ensure it works. Commented Jun 15, 2020 at 23:58
  • 1
    Thanks @JeremyCaney for the correction. I'm new to the editor used for answering here. Will surely take note of the errors in future posts.
    – pr0f3ss0r
    Commented Jun 22, 2020 at 9:46
4

I used 64bit VS Code installer

copy and paste this codes into your pc notepad

save as vscode.reg

then open and merge that saved file. happy coding.

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 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:\\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 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:\\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\""
3

I had the same issue with earlier version of VS code 64 bit. It didn't work even after I re-installed by checking the above mentioned options.

I have installed the latest update of code v1.25.0, and the issue was automatically fixed.

vs code version

Please find the 64 bit regedit fix here.

1
  • 1
    The reg file at the linked location worked for me on Win 10 64 bit after adjusting for personalised installation path. Commented Apr 13, 2019 at 13:35
3

Just re run the installer and select the options in the setup and let it install. You'll not loose any data. Everything will be still intact as it was before. It just adds the missing settings and updates the path.

3

The quickest solution was to download Visual Studio Code, and reinstall it again.

enter image description here

Then check the boxes that says "Open with Code"

2

As an alternative, you can also add the path of vscode installation folder in the Environment Variable => User Variable => Path now with the command prompt you just have to type

code c:\

and it will open the c:\ in vscode.

If you don't want to open cmd.exe you can just type code before the path, as shown below enter image description here

You need to surround the path as string ".." if the path contains space between

and this will open c:\Windows in vscode

0
2

This questions already has a lot of answers but here is one that will work for any user if VS Code installation folder is in the user's AppData folder, no changing the user name required!

It is based on the original idea by Dave Johnson here, and the answer of @Wosi here, among others in this thread.

I used the %USERPROFILE% environment variable (recognized only in the user context, see here) which refers to C:\\Users\<username>.

For environment variables to be expanded from Registry values, the values must be of type REG_EXPAND_SZ (including the Default value of the keys if they also contain environment variables), and values of this type are not stored as classic text in a .reg file, but as a hex data format. I created the Default values for the new keys with the REG_EXPAND_SZ type using another key I exported to a .reg to avoid using commands (even if I think REG_SZ would have been enough for them in this particular case). See here and here.

Windows Registry Editor Version 5.00

; Open files

[HKEY_CLASSES_ROOT\*\shell\VSCode]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,77,00,26,00,69,00,74,00,68,00,20,00,43,\
  00,6f,00,64,00,65,00,00,00
"Icon"=hex(2):25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
  00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
  6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
  00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
  53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
  00,78,00,65,00,00,00

[HKEY_CLASSES_ROOT\*\shell\VSCode\command]
@=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
  00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
  6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
  00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
  53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
  00,78,00,65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00

; 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]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,46,00,6f,00,6c,00,64,00,65,00,72,00,20,\
  00,61,00,73,00,20,00,56,00,53,00,20,00,43,00,6f,00,64,00,65,00,20,00,50,00,\
  72,00,6f,00,6a,00,65,00,63,00,74,00,00,00
"Icon"=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,\
  00,4c,00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,\
  4c,00,6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,\
  00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,\
  56,00,53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,\
  00,65,00,78,00,65,00,22,00,2c,00,30,00,00,00

[HKEY_CLASSES_ROOT\Directory\shell\VSCode\command]
@=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
  00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
  6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
  00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
  53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
  00,78,00,65,00,22,00,20,00,22,00,25,00,31,00,22,00,00,00

; 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]
@=hex(2):4f,00,70,00,65,00,6e,00,20,00,46,00,6f,00,6c,00,64,00,65,00,72,00,20,\
  00,61,00,73,00,20,00,56,00,53,00,20,00,43,00,6f,00,64,00,65,00,20,00,50,00,\
  72,00,6f,00,6a,00,65,00,63,00,74,00,00,00
"Icon"=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,\
  00,4c,00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,\
  4c,00,6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,\
  00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,\
  56,00,53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,\
  00,65,00,78,00,65,00,22,00,2c,00,30,00,00,00

[HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode\command]
@=hex(2):22,00,25,00,55,00,53,00,45,00,52,00,50,00,52,00,4f,00,46,00,49,00,4c,\
  00,45,00,25,00,5c,00,41,00,70,00,70,00,44,00,61,00,74,00,61,00,5c,00,4c,00,\
  6f,00,63,00,61,00,6c,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,73,\
  00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,20,00,56,00,\
  53,00,20,00,43,00,6f,00,64,00,65,00,5c,00,43,00,6f,00,64,00,65,00,2e,00,65,\
  00,78,00,65,00,22,00,20,00,22,00,25,00,56,00,22,00,00,00

Edit: you can verify I am not haking into your registry by verifying the hex values with this tool :)

1

try to find out the Microsoft vs Code files it is some time in the default location and sometimes it is in C:\Users\PAPPU KUMAR\AppData\Local\Programs\Microsoft VS Code.

and then add it to the vscode.reg(create one) files.

Windows Registry Editor Version 5.00

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

An option, Open with Code Insiders, is being added to the Insiders Build 1.73, specifically for Windows 11. See v1.73 Release Notes:

Windows 11 Context menu

In this release, we are adding the Open with Code Insiders context menu entry to Windows 11 context menu for insiders by default. For users, who had previously opted into the context menu when installing the insiders, the entry which would show up in the old style menu Shift + F10 will now be replaced with the newer entry when updating to the latest insiders. For others, you would need to reinstall insiders and opt-in to enable this menu entry in the setup wizard. Due to the issues we have encountered during development of this menu entry, we plan to iterate on this feature with insiders for a couple of milestones to gain confidence before we can push this out to stable release for all Windows 11 users.

Windows 11 context menu: Open with Code Insiders

1
1

There are a lot of versions here on this page. In order to understand what was really done during the installation, I followed the code of the installer.

The easiest way to solve this issue is by using the installer but if you are using a portable version or whatever reason then basically, it is relevant only for Windows 10 and earlier, but it also works on Windows 11 if you use the old-style menu.

If you are using a version without admin rights then change the HKLM to HKCU(HKEY_CURRENT_USER)

You can put the code in a .reg file or run it manually. The first entry of the file is optional, but I added it as it shows in the code. Needless to say, you need to set the path to your VSCode location.

Please look at the code at the relevant line (the link I added it is on lines 1272-1284) if you want to see for yourselves.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\VSCodeContextMenu]
"Title"="Open with Code"

; when you right click a file
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\VSCode]
@="Open with Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\*\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; when you right click a folder
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%1\""

; when you right click a folder while holding shift
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\Background\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""

; when you right click the background, not on a particular file or folder.
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\VSCode]
@="Open Folder in Code"
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\VSCode\command]
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\""
0

This problem usually occurs when the vs code user has standard user role. On VS Code installation admin prompt pops up which means that vs code is installed as admin user. If you ticked the boxes, the shortcuts are added but applied only on admin account which was typed into admin prompt on installation.

Quick workaround is to temporary add the current user (who will use the vs code) to administrators group, uninstall and then install VS Code again with the current user admin rights, and after installation remove the user from the admin group.

0

VSCode installation directory is C:\Users\{Username}\AppData\Local\Programs\Microsoft VS Code by default. You can check from here

Make a install.reg file with this content and run it.

Windows Registry Editor Version 5.00
; Open files
[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CURRENT_USER\Software\Classes\*\shell\Open with VS Code\command]
@="\"C:\\Users\\Administrator\\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_CURRENT_USER\Software\Classes\Directory\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CURRENT_USER\Software\Classes\Directory\shell\vscode\command]
@="\"C:\\Users\\Administrator\\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_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode]
@="Open Folder as VS Code Project"
"Icon"="\"C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CURRENT_USER\Software\Classes\Directory\Background\shell\vscode\command]
@="\"C:\\Users\\Administrator\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\""
-1

Follow this Steps You will Definitely , Get - Open With Code in Explorer.

Why you are not getting this ,because You Didn't Add that to visual studio code while you install , backup Your Projects, if you have, hen just follow this steps For Windows User:

  1. Uninstall Visual Studio Code From. Control Panel\Programs\Programs and Features : image

  2. Reinstall Visual studio : here You Get/Download : https://code.visualstudio.com/download

  3. While install , Stop at Select Additional Tasks, Tick open with options - 2 boxes which is available at install process, complete your installation : image

  4. It's Done , check at explorer. You will find that in explorer : image

You Can Also , Try other methods, registry Editor - that's complicated -

-3

Open VS Code, Go to Settings, Search Context Menu and Check enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.