文件右击添加vscode打开选项
效果如图:
![](https://img2020.cnblogs.com/blog/1884998/202101/1884998-20210106134705478-1403193489.png)
方式一:运行注册文件
- 在任意位置创建一个文本
- 复制下面的代码到文件中以;开头的,是备注信息不需要做任何修改
- 找到自己的vscode.exe文件所在的位置把上面带Code.exe的路径替换掉
- 把上面的文件的后缀改成 reg 注册表专用的格式
- 右键该文件, 管理员获得所有权
- 双击运行该注册表文件, 如果被360什么的拦截了, 点击同意就行了
Windows Registry Editor Version 5.00
; Open files
[HKEY_CLASSES_ROOT*shellOpen with VS Code]
@="Edit with VS Code"
"Icon"="E:\sys-ware\Microsoft VS Code\Code.exe,0"
[HKEY_CLASSES_ROOT*shellOpen with VS Codecommand]
@=""E:\sys-ware\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_ROOTDirectoryshellvscode]
@="Open in VScode"
"Icon"=""E:\sys-ware\Microsoft VS Code\Code.exe",0"
[HKEY_CLASSES_ROOTDirectoryshellvscodecommand]
@=""E:\sys-ware\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_ROOTDirectoryBackgroundshellvscode]
@="Open in VScode"
"Icon"=""E:\sys-ware\Microsoft VS Code\Code.exe",0"
[HKEY_CLASSES_ROOTDirectoryBackgroundshellvscodecommand]
@=""E:\sys-ware\Microsoft VS Code\Code.exe" "%V""
方式二: 在注册表中进行配置
1.win + r
调出运行窗口 运行 regedit
指令
2.在shell目录新建项vscode
位置:计算机HKEY_LOCAL_MACHINESOFTWAREClassesDirectoryshell
3.按照图中文件配置, 配置好重启即可