使用VS Code的过程中非常好奇,为什么没有 在文件或者文件夹上右键可以使用VS Code打开的快捷键。 自己傻逼了,安装的时候粗心了,因为如上图默认是 不选中的,所以就看不到了。
解决的方式是可以自己重新安装, 然后选中选项。
或者使用下面的cmd 修改注册表(不熟悉的不推荐啊)
在桌面新建记事本文件,然后打开添加如下代码:
Windows Registry Editor Version 5.00 ; Open files [HKEY_CLASSES_ROOT\*\shell\Open with VS Code] @="Edit with VS Code" "Icon"="E:\\Program Files (x86)\\Microsoft VS Code\\Code.exe,0" [HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command] @="\"E:\\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"="\"E:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\shell\vscode\command] @="\"E:\\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"="\"E:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\",0" [HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command] @="\"E:\\Program Files (x86)\\Microsoft VS Code\\Code.exe\" \"%V\""
将其另存为“vsCodeOpenFolder.reg”文件
注意:VS Code的安装路径这里使用的是默认的“E:\\Program Files (x86)\\Microsoft VS Code\\” 你要换成你安装的路径才对。
然后双击这个文件就行了, 如果有问题就以管理员的身份运行。