【MedusaSTears】添加右键菜单:用xx打开(管理员身份下,也可以运行)【解决 ShellExecute failed (2): Is this command correct? 的问题】


吃水不忘挖井人系列

鼠标右键vsCode打开

具体步骤

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)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值