文章目录
吃水不忘挖井人系列
具体步骤
1.安装vscode;或者 Notepad++
2.新建一个“.reg”为后缀的文件;
3.把下面内容复制到文件中;
【示例中展示的是Notpad++】
如果想改成vscode请看第4步
Windows Registry Editor Version 5.00
; 此注册表适配 Notepad++ 、 VS Code 等
; Edit files
; 这里的配置,将会出现在 某个指定文件的右键菜单
[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++]
@="Edit with Notepad++"
"Icon"="D:\\dev-tools\\Notepad++\\notepad++.exe,0"
[HKEY_CLASSES_ROOT\*\shell\Edit with Notepad++\command]
@="\"D:\\dev-tools\\Notepad++\\notepad++.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\Notepad++]
;@="Open with Notepad++"
;"Icon"="\"D:\\dev-tools\\Notepad++\\notepad++.exe\",0"
;[HKEY_CLASSES_ROOT\Directory\shell\Notepad++\command]
;@="\"D:\\dev-tools\\Notepad++\\notepad++.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\Notepad++]
;@="Open with Notepad++"
;"Icon"="\"D:\\dev-tools\\Notepad++\\notepad++.exe\",0"
;[HKEY_CLASSES_ROOT\Directory\Background\shell\Notepad++\command]
;@="\"D:\\dev-tools\\Notepad++\\notepad++.exe\" \"%V\""
4.替换路径
把D:\\dev-tools\\Notepad++\\notepad++.exe
换成安装 软件 的路径
可以用 编辑器的 替换功能
比如把 D:\\dev-tools\\Notepad++\\notepad++.exe
替换成 D:\\dev-tools\\Microsoft VS Code\\Code.exe
5.【可以忽略】将reg文件移动
把文件名后缀为.reg的文件放到 软件 对应的文件夹中;
6.双击文件名后缀为.reg的文件,弹出询问是否注册,点击确定;
7.回到桌面,鼠标右键检查是否出现图片的样子
解决 ShellExecute failed (2): Is this command correct?
的问题
常见的Notepad++ 添加右键菜单的方式是:
注册 Notepad++.exe 所在目录下的 NppShell_xx.dll
这个文件
比如我的就是 NppShell_06.dll
但是这个注册方式会有一个问题,倘若修改了 Notepad++ 的兼容性,用管理员身份运行
那么就会报错 ShellExecute failed (2): Is this command correct?
查遍全网,竟然没有 一键解决
的方式,真的是太垃圾了
所以自己搞了一个
这个问题的根因的了解,还得感谢以下两篇文章
Win10 NotePad++ “ShellExecute failed (2): Is this command correct?”_Jim_Huang_GZ的博客-CSDN博客
How to Fix “ShellExecute failed (2): Is this command correct?” on Notepad++ | Tim Tech Support (timourrashed.com)