为所有桌面快捷方式创建C#定制右键上下文菜单项(Windows资源管理器) [英] Create custom right-click context menu item with C# for all desktop shortcuts (windows explorer)

查看:320
本文介绍了为所有桌面快捷方式创建C#定制右键上下文菜单项(Windows资源管理器)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题很简单:我有很多指向了大量文件的桌面快捷方式,但我也有很多指向这些快捷方式指向目录的快捷方式。我想通过简单地增加一个右键菜单选项的所有快捷方式(.LNK文件),它允许你打开Explorer.exe的包含文件指向的目录中删除此冗余。

The problem is easy: I've a lot of desktop shortcuts which points to a lot of file, BUT I also have a lot of shortcuts which points to directories pointed by those shortcuts. I want to remove this redundance by simply adding another rightclick menu options for all shortcuts (.lnk files) that allows you to open explorer.exe to the directory containing the file pointed.

虽然我发现了如何以检索快捷方式的目标,它的工作,我发现了如何增加一个菜单项,单击鼠标右键上下文菜单的建议,但它不工作(我把一键HKCR下* \shellext\ContextMenuHandlers所谓的测试和设置基本值设置为cmd.exe的

While I discovered how to retrive the target of a shortcut and it's working, I found a suggestion on how adding a menu item to rightclick context menu, but it's not working (I put a key under HKCR*\shellext\ContextMenuHandlers called Test and set the base value to "cmd.exe"

不过,这并不工作,obviusly

But it doesn't work, obviusly

任何建议

更新1:
如何将图标添加到菜单项应图标文件有多大? ?16×16或32×32?

Update 1: How to add an icon to that menu item?What size should the icon file have? 16x16 or 32x32?

感谢

推荐答案

走进 HKCR\lnkfile

创建一个名为壳新的密钥,再下面创建另一个关键名为不管你要显示的文字是你的上下文菜单的处理程序,我打电话给我的命令。

Create a new key called "shell", and below that create another key called whatever you want the display text to be for your context menu handler, I called mine "COMMAND".

接下来,创建下面那个叫专命令的又一重点,使(默认)值是cmd.exe的,这将是路径到您的自定义命令。请记住,包装在引号,如果你打算将指向包含空格exe文件。

Next, create yet another key below that called specifically "command" and make the (Default) value be "cmd.exe", which will be the path to your custom command. Remember to wrap it in quotes if you're going to be pointing to an exe that has spaces.

因此,对于本实施例中,最后的密钥最终被

So for this example, the final key ends up being:

HKCR\lnkfile\shell\COMMAND\command\

添加(默认)上面提到的,你的测试将是工作的罚款价值。

Add the (Default) value mentioned above and your test will be working fine.

此外,可以使用%1指定的完整路径.lnk文件的情况下被访问菜单,请再次记住包装在引号,因为你永远不知道它是否会是具有空格,它的全路径的文件。

Additionally, you can use "%1" to specify the full path to the .lnk file being accessed by the context menu, again remember to wrap it in quotes since you never know if it'll be a file that has spaces in it's full path.

这篇关于为所有桌面快捷方式创建C#定制右键上下文菜单项(Windows资源管理器)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆