如何将上下文菜单项添加到Windows资源管理器中的文件夹 [英] How add context menu item to Windows Explorer for folders
问题描述
我发现了如何通过向注册表添加项来向Windows资源管理器上的文件添加右键单击上下文菜单项。即我可以右键单击资源管理器中的文件,然后对该文件运行自定义应用程序。
I have found out how to add right-click context menu items to files on Windows Explorer, by adding keys to the registry. I.e. I can right-click on a file in Explorer and run a custom app against that file.
我想对文件夹执行相同操作,但没有找到解决方法为此(尚未)。我看到了有关创建/编写自定义上下文菜单处理程序的文章,但我不想去那儿。
I would like to do the same for a folder and have not found a way to do that (yet). I see articles on creating/writing custom context menu handlers, but I would rather not go there.
我找到了一篇文章此处有关如何添加级联上下文菜单项目到桌面和资源管理器中的计算机,但这不适用于任何文件夹。
I have found an article here on how to add cascading context menu items to the Desktop and to the "Computer" in Explorer, but this does not work for any folder.
我希望能够将自定义应用添加到上下文菜单,并且可以在文件和文件夹上使用。有没有写上下文菜单处理程序的方法?
I would like to be able to add my custom app to the context menu and have it work on both files and folders. Is there a way to do this without writing a context menu handler?
我在下面的文章中找到了解决方案,其中描述了如何通过注册表对文件和文件夹执行此操作:
I found the solution in the below article, which describes how to do this via the registry for files, as well as for folders:
- How to Add Any Application Shortcut to Windows Explorer’s Context Menu
以下两篇文章提供了其他信息和选项:
The following two articles provided additional info and options:
- Ultimate Tutorial to Customize Desktop Context Menu in Windows Vista, 7 and 8
- Add Cascading Menus for Your Favorite Programs in Windows 7 Desktop and My Computer Context Menus
推荐答案
在注册编辑器中( regedit.exe
)查找:
In the registration editor (regedit.exe
) find:
-
的上下文菜单>右键单击Windows资源管理器左面板中的文件夹或右面板中目录的背景:
Context menu for right click on folders in left panel of Windows Explorer or on background of a directory in right panel:
-
HKEY_CLASSES_ROOT\目录\背景\外壳
如果您是管理员 -
HKEY_CURRENT_USER\Software\Classes\目录\背景\外壳
(如果您是普通用户)
HKEY_CLASSES_ROOT\Directory\Background\shell
if you are administratorHKEY_CURRENT_USER\Software\Classes\directory\Background\shell
if you are a normal user
右键单击Windows资源管理器右面板中的文件夹:
-
HKEY_CLASSES_ROOT\目录\ \shell
(如果您是管理员) -
HKEY_CURRENT_USER\Software\Classes\目录\shell
如果您是普通用户
HKEY_CLASSES_ROOT\Directory\shell
if you are administratorHKEY_CURRENT_USER\Software\Classes\directory\shell
if you are a normal user
任何文件的上下文菜单:
Context menu for any file:
-
HKEY_CLASSES_ROOT\ * \ shell
(如果您是管理员) -
HKEY_CURRENT_USER\Software\类** shell
(如果您是普通用户)
HKEY_CLASSES_ROOT\*\shell
if you are administratorHKEY_CURRENT_USER\Software\Classes\*\shell
if you are a normal user
在所有情况下:
- 在
shell
下添加新密钥,将其命名为您要命名
上下文菜单项 - 在此键中添加一个名为
command
的新键(强制性名称) - 将
命令
中的默认值
属性编辑为
myprogrampath\path\path\executable.exe%1
将文件路径和所选文件的
名称传递到自定义程序
- add a new key under
shell
, naming it as you want to name the context menu item - add a new key inside this key, named
command
(mandatory name) - edit the
default
property incommand
tomyprogrampath\path\path\executable.exe %1
to pass the file path and name of the selected file to your custom program
更多自定义设置:
More customization:
- 添加图标:为在步骤1创建的键添加名为
icon
的字符串值,其值与图标资源路径匹配。您还可以提供一个整数参数来指定要使用的图标。示例:%SystemRoot%\System32\shell32.dll,3
- 仅在按住Shift并单击时显示:为在步骤1创建的密钥添加一个名为
扩展
的空字符串值 - 自定义菜单项标签 >:更改在步骤1创建的键的默认值
- 更改菜单项的位置:添加一个名为
Position <的字符串值/ code>,其中之一:
顶部
,底部
- Add icon: add a string value named
icon
for key created at step 1 with value matching an icon resource path. You can also provide an integer arguments to specify which icon to use. Example:%SystemRoot%\System32\shell32.dll,3
- Display only on shift-click: adds an empty string value named
Extended
for key created at step 1 - Customize menu entry label: change the value of default value for key created at step 1
- Change menu entry location: add a string value named
Position
with one of:Top
,Bottom
这篇关于如何将上下文菜单项添加到Windows资源管理器中的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!