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.
Copied from http://thisdavej.com/right-click-on-windows-folder-and-open-with-visual-studio-code/
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_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
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\""
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
These settings are normally stored per-user for VS Code.
To set for a new user account: re-run the installer.
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\""
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.
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.
Please find the 64 bit regedit fix here.
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.
来源:https://stackoverflow.com/questions/37306672/visual-studio-code-open-with-code-does-not-appear-after-right-clicking-a-folde