关于 VScode, 点击文件右键或者在文件夹中没有 【 在vscode中打开选项】 解决办法

发布于:2024-04-07 ⋅ 阅读:(127) ⋅ 点赞:(0)

关于 VScode, 点击文件右键或者在文件夹中没有 【 在vscode中打开选项】 解决办法

段子手-168 2024-4-6

1、在任意位置创建一个文本文件。如:a.txt

2、复制以下代码到 a.txt 文本文件中。
(注: 以 ; 开头的 , 是备注信息 , 不需要做任何修改)


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

3、找到自己的 vscode.exe 文件所在的位置 , 把上面带 【Code.exe】
的所有路径换成你自己的 vscode 安装路径写上去。

4、查看自己的 vscode 安装路径:

右键 vscode 图标(如桌面 vscode)
—> 属性
—> 复制 【目标(T)】后面的地址路径,就是你的 vscode 安装路径。
在这里插入图片描述

5、修改 a.txt 文件的后缀,改成 a.reg 注册表专用的格式。

6、注意:如果没有显示文件后缀名,可以如下操作:
1)打开任意一个文件浏览器窗口,
【查看】 —> 【显示】—> 勾选 【文件扩展名】
在这里插入图片描述
2)或者 点击 【…】—> 【选项】—> 【查看】—> 取消勾选【隐藏已知文件类型的扩展名】。
在这里插入图片描述

7、右键 a.reg 该文件, 管理员获得所有权。

8、双击运行该注册表文件 a.reg, 如果被360什么的拦截了, 点击同意就行了。

Open in VScode
Edit with VS Code

这两个文件是 鼠标右键展示的文字