AI摘要:忘记在安装VSCode时勾选“添加在VSCode中打开”的选项?别担心,你可以手动添加它。在Windows上,创建一个名为`vscode.reg`的文件,里面包含一些注册表项,然后双击导入注册表即可。这些注册表项指定了右键菜单中的“在VSCode中打开”选项,包括在文件和文件夹上右键单击时和文件夹内部右键单击时出现的选项。

如果你安装 Visual Studio Code (VSCode) 时忘记勾选了 "添加在 VSCode 中打开的菜单" 选项,你可以手动添加它。以下是如何在 Windows 上添加 "在 VSCode 中打开" 菜单项的方法。

先保存下面的内容为vscode.reg

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

然后双击导入注册表即可