右键单击“打开"有论据 [英] Right-click "Open" with arguments

查看:43
本文介绍了右键单击“打开"有论据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 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:

  1. HKEY_Classes_Root下,找到键.exe
  2. 读取(默认) 值(通常是exefile)
  3. HKEY_Classes_Root 下,找到键 exefile(或您在第 2 步中找到的任何内容)
  4. exefile\shell 下创建一个新密钥,其名称与您希望在上下文菜单中看到的名称相匹配(例如,使用我的应用程序打开")
  5. 在您的新密钥下,创建一个名为 command
  6. 的新密钥
  7. 将此键的 (Default) 值设置为您要执行的任何命令行.可以使用标记 %1 输入您单击的文件的名称.因此,例如,您可以将该值设置为 notepad.exe %1 以在记事本中编辑可执行文件.
  1. Under HKEY_Classes_Root, find key .exe
  2. Read the (Default) value (this is usually exefile)
  3. Under HKEY_Classes_Root, find key exefile (or whatever you found in step 2)
  4. 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")
  5. Under your new key, create a new key called command
  6. 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 to notepad.exe %1 to edit the executable in Notepad.

类似的模式适用于其他文件类型.

A similar pattern will work for other file types.

这篇关于右键单击“打开"有论据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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