将vscode设置到右键菜单中

本文介绍了一种通过编辑注册表来实现VSCode右键菜单快速打开文件或项目的详细方法,包括对文件、文件夹及背景点击时的响应设置。

由于安装的时候没有设置好,导致不能用右键快速打开vscode

在网上查到了以下方法:

1.新建文件,拷贝代码进去

  ; 是注释

Windows Registry Editor Version 5.00 
 
; Open files 
[HKEY_CLASSES_ROOT\*\shell\Open with VS Code] 
@="Edit with VS Code" 
"Icon"="C:\\Program Files\\Microsoft VS Code\\Code.exe,0" 
 
[HKEY_CLASSES_ROOT\*\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_CLASSES_ROOT\Directory\shell\vscode] 
@="Open Folder as VS Code Project" 
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0" 
 
[HKEY_CLASSES_ROOT\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_CLASSES_ROOT\Directory\Background\shell\vscode] 
@="Open Folder as VS Code Project" 
"Icon"="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\",0" 
 
[HKEY_CLASSES_ROOT\Directory\Background\shell\vscode\command] 
@="\"C:\\Program Files\\Microsoft VS Code\\Code.exe\" \"%V\"" 

2.保存,改后缀名为reg 管理员权限运行

当安装 Visual Studio Code 时没有勾选添加右键菜单,若想重新将其快捷打开方式添加右键菜单,可通过修改注册表实现,具体步骤如下: 1. **打开注册表**:按“window + r”打开运行窗口,输入“regedit”,点击“确定” [^2]。 2. **找到对应文件地址并操作**: - **方法一**: - 右键“shell”,新建项,重命名为“Open With VS”。 - 右键上述新建项“Open With VS”,新建字符串,重命名为“Icon”。 - 重命名完成之后,双击“Icon”,找到“Code.exe”的路径,按相应格式命名(表示选择要在右键中显示的图标)。 - 双击“默认”,修改值为“Open With VS”(自定义,表示右键菜单中显示的字符串)。 - 右键,新建项,命名为“command” [^4]。 - **方法二**: 在“VisualCode”下再新建“Command”项,在右侧窗口的“默认”键值栏内输入程序所在的安装路径,如:“D:\Program Files (x86)\VSCode\code.exe” “%1”。其中的“%1”表示要打开的文件参数 [^3]。 - **方法三**: 可以直接添加以下注册表内容: ```plaintext Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell\VSCode] @="Open with Code" "Icon"="D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\*\shell\VSCode\command] @="\"D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%1\"" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\shell\VSCode] @="Open with Code" "Icon"="D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\Directory\shell\VSCode\command] @="\"D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\"" Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode] @="Open with Code" "Icon"="D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe" [HKEY_CLASSES_ROOT\Directory\Background\shell\VSCode\command] @="\"D:\\Users\\墨宿\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe\" \"%V\"" ``` 需要注意将路径替换为自己实际的 VSCode 安装路径 [^5]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值