将新文件类型添加到 Windows 7 的新上下文菜单
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6257543/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Adding new filetypes to Windows 7's New context menu
提问by And Finally
I'm trying to add CSS, PHP, JS and HTML file types to the "New" right click menu in Windows 7. I know how to add the file types to the menu with ShellNew entries in the registry. But Windows doesn't give you any control over the display names of the new items - according to thisthe name's always taken from whatever application you've assigned to open the doc. I've set Notepad++ to open all of these file types, so I'm going to end up with several identical "Notepad++ document" entries in the menu, like this:
我正在尝试将 CSS、PHP、JS 和 HTML 文件类型添加到 Windows 7 中的“新建”右键单击菜单中。我知道如何使用注册表中的 ShellNew 条目将文件类型添加到菜单中。但是 Windows 不会让您对新项目的显示名称进行任何控制 - 据此,该名称始终取自您分配用于打开文档的任何应用程序。我已经将 Notepad++ 设置为打开所有这些文件类型,所以我最终会在菜单中看到几个相同的“Notepad++ 文档”条目,如下所示:
Does anybody know if there's a way out of this stupid situation without installing any tweak utilities?
有人知道在不安装任何调整实用程序的情况下是否有办法摆脱这种愚蠢的情况吗?
Thanks all! Fred
谢谢大家!弗雷德
回答by Anders
You could change the file type description for each file class manually.
您可以手动更改每个文件类的文件类型描述。
- Look up the prog id under
HKEY_CLASSES_ROOT\.%ext%
(The default value) - Under
HKEY_CLASSES_ROOT\%progid%
, set the default value and/or the "FriendlyTypeName" string to the string you want.
- 在
HKEY_CLASSES_ROOT\.%ext%
(默认值)下查找 prog id - 在 下
HKEY_CLASSES_ROOT\%progid%
,将默认值和/或“FriendlyTypeName”字符串设置为您想要的字符串。
You might have to log off for it to take effect. You should probably stay away from the Chrome and Notepad++ file type/association dialogs so they don't overwrite your strings.
您可能需要注销才能生效。您可能应该远离 Chrome 和 Notepad++ 文件类型/关联对话框,以免它们覆盖您的字符串。
Both Chrome and Notepad++ are open source, you can create a patch for them that use better names for the file types. (What is a "Chrome HTML Document" anyway, HTML5 + extra chrome juice? =) )
Chrome 和 Notepad++ 都是开源的,您可以为它们创建补丁,为文件类型使用更好的名称。(无论如何,什么是“Chrome HTML 文档”,HTML5 + 额外的 chrome 果汁?=))
回答by mythofechelon
To rename a context menu > new's item (in Windows 7, at least):
要重命名上下文菜单 > 新建项(至少在 Windows 7 中):
- Open regedit.
- Go to
HKEY_CLASSES_ROOT\.%ext%
and note the(Default)
value. This is the file extension's ProdID. - Go to
HKEY_CLASSES_ROOT\%ProdID%
(usually%ext%file
) using the value obtained from step two. Set the(Default)
value to whatever you would like the context menu new item to display as. - Under
HKEY_CLASSES_ROOT\%ProdID%
, if there is aFriendlyTypeName
value, rename it toFriendlyTypeName.old
, as the(Default)
value "is deprecated by the FriendlyTypeName entry"
- 打开注册表。
- 转到
HKEY_CLASSES_ROOT\.%ext%
并记下该(Default)
值。这是文件扩展名的 ProdID。 - 使用从第二步获得的值转到
HKEY_CLASSES_ROOT\%ProdID%
(通常%ext%file
)。将该(Default)
值设置为您希望上下文菜单新项目显示为的任何值。 - 在 下
HKEY_CLASSES_ROOT\%ProdID%
,如果有FriendlyTypeName
值,则将其重命名为FriendlyTypeName.old
,因为该(Default)
值“已被 FriendlyTypeName 条目弃用”
I don't believe there is even a need to log out / restart, but if the changes don't take effect, log out and/or restart.
我认为甚至不需要注销/重新启动,但如果更改没有生效,请注销和/或重新启动。
回答by Viswalinga Surya S
I was able to derive a solution from the answers above.
我能够从上面的答案中得出一个解决方案。
I replicated the particular application (JetBrains PHPStorm in my case) registry entry.
PHPStorm2019.1 -> PHPStorm2019.1.scss, PHPStorm2019.1.js.
Now I changed the Default REG_SZ of
PHPStorm2019.1.scss
to SCSS FileandPHPStorm2019.1.js
to JavaScript file.Mapped
.scss
and.js
toPHPStorm2019.1.scss
andPHPStorm2019.1.js
respectively.
我复制了特定的应用程序(在我的例子中是 JetBrains PHPStorm)注册表项。
PHPStorm2019.1 -> PHPStorm2019.1.scss、PHPStorm2019.1.js。
现在我改变了默认REG_SZ
PHPStorm2019.1.scss
到SCSS文件,并PHPStorm2019.1.js
以JavaScript文件。映射
.scss
和.js
以PHPStorm2019.1.scss
和PHPStorm2019.1.js
分别。