最佳答案
复制自 Right click on Windows folder and open with Visual Studio Code
使用以下内容创建文件vsCodeOpenFolder.reg(如果您没有选择默认安装路径,则需要调整此文件中的路径):
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\""
双击它以创建注册表项。
如果“用代码打开”没有出现在资源管理器的上下文菜单中,那么您应该重新启动系统。
如果您运行的是 64 位或 Insiders 版本的 VS Code,请相应地更改路径。 IE。
C:\\Users\\[用户名]\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe
关于windows-7 - 右键单击文件夹后不出现 Visual Studio Code "Open With Code",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37306672/