AI摘要:如果你在安装VS Code时没有选择添加右键菜单,又不想重新安装,你可以通过修改注册表来实现。将上述代码保存为`VSCode.reg`,然后双击导入注册表即可。要记得修改VS Code的安装路径。这样一来,在文件夹右键菜单中就会增加使用VS Code打开的选项了。

安装 VS Code 的时候没有选择添加右键菜单,然后又不想重新安装 VS Code,可以把下面的代码保存为VSCode.reg,双击导入注册表即可。记得修改 VS Code 安装路径。

Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code]
@="Edit with VS Code"
"Icon"="C:\\Users\\Ryan\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code\command]
@="\"C:\\Users\\Ryan\\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]
@="在 VS Code 中打开"
"Icon"="\"C:\\Users\\Ryan\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\shell\vscode\command]
@="\"C:\\Users\\Ryan\\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]
@="在 VS Code 中打开"
"Icon"="\"C:\\Users\\Ryan\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\",0"
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command]
@="\"C:\\Users\\Ryan\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\""