我正在尝试为*.zip文件添加上下文菜单。使用nesseary参数启动python脚本。在
我添加了以下注册表项:
[HKEY_CLASSES_ROOT\WinZip\shell\SSSeracher] "MUIVerb"="SSSearcher Script" "SubCommands"="SSSearcher.Rule1;SSSearcher.Rule2;SSSearcher.Rule3;SSSearcher.Custom;SSSearcher.Config"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule1] @="Rule #1"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule1\command] @="C:\\APPS\\python\\Scripts\\sssearcher.py \"%1\" \"1\""
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule2] @="Rule #2"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule2\command] @="C:\\APPS\\python\\Scripts\\sssearcher.py \"%1\" \"2\""
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule3] @="Rule #3"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Rule3\command] @="C:\\APPS\\python\\Scripts\\sssearcher.py \"%1\" \"3\""
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Custom] @="Custom rule"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Custom\command] @="C:\\APPS\\python\\Scripts\\sssearcher.py \"%1\" \"4\""
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Custom] @="Custom rule"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Custom\command] @="C:\\APPS\\python\\Scripts\\sssearcher.py \"%1\" \"4\""
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Config] @="Config File"
[HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\SSSearcher.Config\command] @="vim C:\\APPS\\python\\Scripts\\sssearcher.pyc"
当菜单出现时,点击这些绝对没有什么作用。在
我一直在遵循本教程: http://msdn.microsoft.com/en-us/library/windows/desktop/hh127467%28v=vs.85%29.aspx
我遗漏了一些东西,但不幸的是我找不到答案。你能帮我吗?
我只是按照以下步骤操作,似乎很管用:
1)首先在
HKEY_CLASSES_ROOT
下找到.zip
键。在2)选择它并查看其默认值。在我的例子中,默认值是
CompressedFolder
:3)现在向下导航到
CompressedFolder\shell
(或者在默认值下为.zip的内容),它也包含在HKEY_CLASSES_ROOT
下:4)右键单击shell并添加一个新键,在我的例子中,我添加了一个名为
MyCommand
的键。向这个键添加一个名为command
的子键。MyCommand
将是出现在上下文菜单上的命令的名称。在5)接下来编辑
command
子键的(Deafult)
项的值,添加要执行的操作。在我的例子中,我想打开一个python文件,它告诉我有关该文件的详细信息:这是python脚本:
它位于C:\信息py在
这是我添加到default的条目:
python C:\\info.py %1
仅此而已,现在如果您右键单击zip文件,就会看到您添加的命令:
点击后显示:
希望这是你以后在哪里。如果您想添加更多的命令,那么只需在
shell
键下添加更多的子键,就像我们对MyCommand
所做的那样。在更新-级联菜单
a)要添加级联菜单,请导航到上述步骤3中所述的键。在我的例子中,这是
CompressedFolder\shell
,它在HKEY_CLASSES\u根下。在这里添加一个具有您选择的名称的密钥,在我的例子中,我使用了CascadeMenu
。向该键添加2个条目:MUIVerb
-这是层叠菜单将出现的名称。在我的例子中,我使用了MyCascadeMenu
SubCommands
-这是一个以分号分隔的命令列表。请随意命名命令,在我的例子中,我使用了python.info
。如果需要分隔符,请在命令之间使用“|”,例如command1;|;command2
b)接下来我们需要告诉windows这个命令的实际作用。导航到:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\Shell
在这里添加一个带有命令名的键。在我的例子中,这个键被称为
python.info
。将键的默认值设置为要在上下文菜单中显示的名称。在我的例子中,我使用了"File Info"
c)现在在命令中添加一个名为
command
的子键。将此命令的默认条目更改为要执行的命令。在我的例子中,我将其设置为python C:\\info.py %1
d)现在我们完成了,右键单击.zip文件以查看新创建的上下文菜单:
相关问题 更多 >
编程相关推荐