在 Windows 7 中添加新的文件关联 [英] Add a new file association in Windows 7

查看:23
本文介绍了在 Windows 7 中添加新的文件关联的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Windows XP 中,我可以使用控制面板添加新的文件扩展名,将其与程序关联,并为其分配图标.我使用控制面板中的文件夹选项来做到这一点.文件夹选项中有一个名为文件类型"的选项卡.

With Windows XP I could use the Control Panel to add a new file extension, associate it with a program, and assign an icon to it. I did that using Folder Options in the Control Panel. Folder Options has a tab in it called "File Types".

但 Windows 7 文件夹选项没有该选项卡.并且建议的文件关联位置(默认程序)不允许我添加新扩展名.

But Windows 7 Folder Options does not have that tab. And the suggested place for file associations (Default Programs) does not let me add a new extension.

我该如何做我想做的事(即,将新扩展与现有程序相关联,并为其应用新图标)?

How do I do what I want to (i.e. associate a new extension with an existing program and also apply a new icon to it)?

推荐答案

不幸的是,这是他们为了使其更简单而变得更复杂的事情之一(例如,您可以更改关联的程序,但仅此而已).

Unfortunately it's one of those things they made more complicated in an attempt to make it more simple (e.g. you're able to change the associated program, but that's it).

您可以使用第三方程序或自己编辑注册表(请勿修改注册表,除非您非常确定自己在做什么!错误可能会破坏设置甚至使您的系统无法启动!):

You can either use third party programs or just edit the registry yourself (do not modify the registry unless you're really sure on what you're doing! Mistakes might break settings or even make your system unbootable!):

  1. 右键单击HKEY_CLASSES_ROOT 并选择NewKey.根据您所需的文件扩展名命名,例如.ext.如果它已经存在,您可以跳过此步骤.
  2. 将您刚刚创建的密钥的默认值设置为某个尚未使用的唯一名称,例如我的文件类型.同样,如果已设置,请跳过此步骤.
  3. 使用您在上一步中选择的相同名称创建另一个新密钥.如果密钥已经存在,也请跳过此步骤.
  4. 将新密钥的默认值设置为应作为文件类型出现在 Windows 资源管理器和其他程序中的名称.
  5. 右键单击新键并创建子键 DefaultIcon.
  6. 将新密钥的默认值设置为 C:\Some\Path\To\Your\Icon\Ressource.ico,0(0 是要使用的图标;如果资源中只有一个图标,则必须为 0).
  7. DefaultIcon 旁边创建另一个新键并将其命名为 shell.
  8. 现在,对于您想要关联的每个动词/动作,创建一个具有所需名称的新子键.一些动词是预设的,会自动使用本地化的名称,例如打开编辑打印.
  9. 为每个动词创建一个子键 command 并将其默认值设置为要运行的程序.还要确保包含所需的所有参数,如果内部有空格,请添加引号,例如"C:\My Path\My Program.exe" "%1".%1 将替换为为此操作选择的实际文件名.
  1. Right click HKEY_CLASSES_ROOT and pick New, Key. Name it according to your desired file extension, e.g. .ext. If it exists already, you can skip this step.
  2. Set the default value of the key you just created to some unique name that isn't used yet, e.g. MyFileType. Again, if it's set already, skip this step.
  3. Create another new key using the same name you picked in the previous step. Skip this too, if the key exists already.
  4. Set the default value of the new key to the name that should appear in Windows Explorer and other programs as the file type.
  5. Right click the new key and create a subkey DefaultIcon.
  6. Set the new key's default value to C:\Some\Path\To\Your\Icon\Ressource.ico,0 (the 0 is the index of the icon to be used; if there's only one icon in the ressource, it has to be 0).
  7. Create another new key next to DefaultIcon and call it shell.
  8. Now, for each verb/action you'd like to associate, create a new sub key with the desired name. Some verbs are preset and will automatically use localized names, e.g. open, edit or print.
  9. For each verb create a sub key command and set its default value to the program to be run. Also make sure to include all parameters needed, adding quotes if there are spaces inside, e.g. "C:\My Path\My Program.exe" "%1". %1 will be replaced with the actual file name picked for this action.

这篇关于在 Windows 7 中添加新的文件关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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