为特定扩展名(不是文件类型)添加Windows Shell上下文菜单项 [英] Add a Windows Shell context menu entry for a specific extension (not file type)

查看:49
本文介绍了为特定扩展名(不是文件类型)添加Windows Shell上下文菜单项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要添加Windows Shell上下文菜单,假设 .txt 文件-如果 .txt HKEY_CLASSES_ROOT 中(或在 HKEY_CURRENT_USER\Software\Classes 中),并不重要)的默认值(文件类型 txtfile -您将命令添加到 HKEY_CLASSES_ROOT\txtfile\shell\ \您的命令(当然,该命令本身也在 HKEY_CLASSES_ROOT\txtfile\shell\您的命令\命令中),然后就可以了。

To add a Windows shell context menu, let's say for .txt files - if the .txt extension in HKEY_CLASSES_ROOT (or in HKEY_CURRENT_USER\Software\Classes, doesn't really matter) has the default value (file type) txtfile - you add the command to HKEY_CLASSES_ROOT\txtfile\shell\yourcommand (and the command itself in HKEY_CLASSES_ROOT\txtfile\shell\yourcommand\command, of course) and there you go.

但是,假设 .txt 扩展名具有默认值记事本++ _文件 Notepad ++ _ file 可能是许多其他扩展名文件类型,因此,如果将命令添加到 HKEY_CLASSES_ROOT\Notepad ++ _ file ,则此命令将针对与Notepad ++相关的每个扩展名出现。

However, let's say the .txt extension instead has the default value Notepad++_file. Notepad++_file might be the file type for many other extensions, so if you add the command to HKEY_CLASSES_ROOT\Notepad++_file, then this command will appear for every extension associated with Notepad++.

因此,问题是:如果可能的话,如何在不更改文件类型的情况下为仅一个特定扩展名添加菜单项

So, the question is: how can you add a menu entry for ONLY ONE specific EXTENSION, without changing its file type, if possible at all?

PS:我不想只复制文件类型,因为将来对原始文件类型的更改不会影响重复的文件类型。

P.S.: I don't want to just duplicate the file type, because future changes to the original file type won't affect the duplicated one.

推荐答案

在这里:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell\your custom app]
@="Open with your custom app"
"icon"="C:\\Windows\\notepad.exe,0"
"AppliesTo"=".nfo"

[HKEY_CLASSES_ROOT\*\shell\your custom app\command]
@="C:\\Windows\\notepad.exe \"%1\""

AppliesTo =。nfo 这行就可以了。

在Windows 10上完美运行。

Works perfectly on Windows 10.

对于每个扩展名,它都有效,无论是否有与该扩展名相关联的应用程序。这样可以减少入侵,并在注册表中留下很小的空间。

It works per file extension, regardless if there is an application associated with that extension or not. Doing this way it less invasive and leaves a very small footprint in the registry.

Compare to Add menu item to windows context menu only for specific filetype

编辑:

如果您想将该命令应用于多个扩展名,请使用:

If you want to apply that command to more than one extension use:

"AppliesTo"="System.FileName:\"*.nfo\" OR System.FileName:\"*.log\""

信用: https://superuser.com/questions/183785/windows-7-context-menu-for-folders-if-folder -contains-certain-filetypes

这篇关于为特定扩展名(不是文件类型)添加Windows Shell上下文菜单项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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