右键单击“打开"有论据 [英] Right-click "Open" with arguments
本文介绍了右键单击“打开"有论据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在 Windows 右键单击菜单中添加一个条目,该条目仅在我右键单击 .exe 或 .msi 文件时出现.如果该条目被选中,则 exe 文件将被执行(如 Open),但使用固定文本字符串作为其参数.
I would like to add an entry to the Windows right-click menu that only appears when I right click on a .exe or .msi file. If the entry is selected, the exe file will be executed (like Open) but with a fixed text string as its argument.
我想这应该可以通过注册表项实现 - 知道如何做到这一点吗?
I guess this should be possible with a registry key - any ideas how to do this?
推荐答案
对于 .exe
文件,您可以在注册表中执行以下操作:
For an .exe
file, you can do the following in the registry:
- 在
HKEY_Classes_Root
下,找到键.exe
- 读取
(默认)
值(通常是exefile
) - 在
HKEY_Classes_Root
下,找到键exefile
(或您在第 2 步中找到的任何内容) - 在
exefile\shell
下创建一个新密钥,其名称与您希望在上下文菜单中看到的名称相匹配(例如,使用我的应用程序打开") - 在您的新密钥下,创建一个名为
command
的新密钥 - 将此键的
(Default)
值设置为您要执行的任何命令行.可以使用标记%1
输入您单击的文件的名称.因此,例如,您可以将该值设置为notepad.exe %1
以在记事本中编辑可执行文件.
- Under
HKEY_Classes_Root
, find key.exe
- Read the
(Default)
value (this is usuallyexefile
) - Under
HKEY_Classes_Root
, find keyexefile
(or whatever you found in step 2) - Under
exefile\shell
create a new key, with a name matching what you want to see in the context menu (say, "Open With My App") - Under your new key, create a new key called
command
- Set the
(Default)
value of this key to whatever commandline you want to execute. The name of the file you clicked on can be entered using the token%1
. So, for example, you could set the value tonotepad.exe %1
to edit the executable in Notepad.
类似的模式适用于其他文件类型.
A similar pattern will work for other file types.
这篇关于右键单击“打开"有论据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文