在Windows 7中添加一个新的文件关联。

时间:2023-01-14 18:29:30

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 XP,我可以使用控制面板添加一个新的文件扩展名,将它与一个程序关联起来,并给它分配一个图标。我在控制面板中使用了文件夹选项。文件夹选项有一个名为“文件类型”的选项卡。

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.

但是Windows 7文件夹选项没有这个选项卡。文件关联的建议位置(默认程序)不允许我添加一个新的扩展名。

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)?

我如何做我想做的(比如将一个新的扩展与一个现有的程序相关联,并应用一个新的图标)?

7 个解决方案

#1


36  

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. 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. 右键单击HKEY_CLASSES_ROOT,然后选择New, Key。根据你想要的文件扩展名来命名它,例如:.ext。如果它已经存在,您可以跳过这一步。
  3. 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.
  4. 将刚才创建的键的默认值设置为未使用的唯一名称,例如MyFileType。如果已经设置好了,跳过这一步。
  5. Create another new key using the same name you picked in the previous step. Skip this too, if the key exists already.
  6. 使用前面步骤中选择的名称创建另一个新密钥。如果键已经存在,也跳过这个。
  7. Set the default value of the new key to the name that should appear in Windows Explorer and other programs as the file type.
  8. 将新密钥的默认值设置为在Windows资源管理器和其他程序中作为文件类型出现的名称。
  9. Right click the new key and create a subkey DefaultIcon.
  10. 右键单击新键并创建一个subkey DefaultIcon。
  11. 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).
  12. 将新键的默认值设置为C:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \。ico,0(0是要使用的图标的索引;如果ressource中只有一个图标,那么它必须为0。
  13. Create another new key next to DefaultIcon and call it shell.
  14. 在DefaultIcon旁边创建另一个新键,并将其命名为shell。
  15. 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.
  16. 现在,对于您想要关联的每个动词/动作,创建一个带有所需名称的新子键。有些动词是预设的,并会自动使用本地化的名称,例如:打开、编辑或打印。
  17. 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.
  18. 对于每个谓词,创建一个子键命令,并将其默认值设置为要运行的程序。还要确保包含所需的所有参数,如果内部有空格,则添加引号。“C:\我的路径\我的程序。exe”“% 1”。%1将替换为为该操作选择的实际文件名。

#2


14  

If "Open With" isn't offered, just click on "Open". If there is no default program already associated with the file type, you'll be given a choice of searching for a suitable program on the Web, or selecting a program from a list of installed programs, just as with the old "Open With".

如果没有提供“打开”,只需点击“打开”。如果没有与文件类型相关联的默认程序,您可以选择在Web上搜索合适的程序,或者从已安装程序的列表中选择一个程序,就像以前的“Open with”一样。

#3


5  

In Windows 7, you can also right click and go Properties -> General Tab and there is "Open with" and [Change] button. This way you can also set association for a new file type.

在Windows 7中,你也可以右击和go属性-> General选项卡,并且有“Open with”和[Change]按钮。这样,您还可以为新的文件类型设置关联。

#4


2  

For Windows, you can always right click and select 'Open With'. Choose the option that says select a program from a list. You can then select your own program and tell it to open files of such extension with that program by default. To change the icons, this link can help you (Change Windows icon)

对于Windows,您总是可以右键单击并选择“Open With”。选择表示从列表中选择一个程序的选项。然后,您可以选择自己的程序,并告诉它在默认情况下打开该程序的扩展文件。要更改图标,此链接可以帮助您(更改Windows图标)

#5


2  

To avoid editing the registry, instead create a new file with the desired extension. When you double-click it you will get the Can't Open dialog and you can select a program from a list of installed programs. Browse to select your desired application, add the description and check the always use the selected program. Now the extension is in the default programs list and can be further edited and changed as you are used to.

为了避免编辑注册表,应该创建一个新文件,并使用所需的扩展名。当你双击它时,你将得到不能打开的对话框,你可以从已安装的程序列表中选择一个程序。浏览以选择您想要的应用程序,添加描述并检查始终使用选定的程序。现在扩展在默认的程序列表中,可以像以前一样进行编辑和修改。

#6


1  

  1. If 'open with' is available after right clicking, it's pretty straight forward. If not...
  2. 如果“open with”是在右击后可用,这是非常直接的。如果不是……
  3. Type 'default programs' into start menu, then select 'set associations'.
  4. 在“开始”菜单中键入“默认程序”,然后选择“set associations”。

I don't know why MS decides to sometimes take away the 'open with' option...

我不知道为什么微软有时会选择“开放”选项……

#7


-1  

Probably to streamline the experience and make it easier to understand (although I don't know why they didn't keep it behind some "advanced" button for power users).

也许是为了简化体验,让它更容易理解(尽管我不知道为什么他们不把它放在“高级”按钮的后面)。

Because that's Microsoft's entire MO in general...presume that every single person that uses their software is incapable of making technical decisions. It would be so simple for them to include one little link in that Default Programs window saying "add an extension", and for that to be linked to another window where you can easily do this within a safe, GUI environment. Instead they force us to edit the registry, which is 10 times more dangerous! And if they're worried about average Joe's wrecking their computers, they could include a simple message box that informs the user of the risk!

因为那是微软的整个MO…假设每个使用他们软件的人都无法做出技术决定。对于他们来说,在默认的程序窗口中包含一个“添加一个扩展”的小链接是非常简单的,并且为了让它链接到另一个窗口,在一个安全的GUI环境中可以很容易地做到这一点。相反,他们强迫我们编辑注册表,这是危险的10倍!如果他们担心普通的乔破坏他们的电脑,他们可能会包括一个简单的消息框,告知用户风险!

Honestly MS, I've been an amateur developer for no more than 10 years, and the biggest software giant in the world can't employ programmers with more, or even an equal level of, knowledge as me?!?! So how did you get to that status in the first place?!?! It really boggles my mind!

老实说,我做了10年的业余开发者,世界上最大的软件巨头不能像我一样雇佣更多的程序员,甚至是同等程度的知识?!?!那么,你是如何从一开始就获得这种地位的呢?!?!这真让我吃惊!

Sorry for not actually adding anything constructive to the discussion but this whole perception by MS of its customers as being non-trustworthy little children really cheeses me off...and I came here in search of an answer to the same question that the OP asked, but I guess there is none (other than messing around with the registry, which I really hate doing).

很抱歉,没有给讨论添加任何建设性的东西,但这整个由她的顾客认为是不值得信赖的小孩的看法真的让我感到厌烦……我来这里是为了寻找答案,也就是OP问的那个问题,但我猜没有(除了注册表之外,我真的很讨厌这样做)。

#1


36  

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. 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. 右键单击HKEY_CLASSES_ROOT,然后选择New, Key。根据你想要的文件扩展名来命名它,例如:.ext。如果它已经存在,您可以跳过这一步。
  3. 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.
  4. 将刚才创建的键的默认值设置为未使用的唯一名称,例如MyFileType。如果已经设置好了,跳过这一步。
  5. Create another new key using the same name you picked in the previous step. Skip this too, if the key exists already.
  6. 使用前面步骤中选择的名称创建另一个新密钥。如果键已经存在,也跳过这个。
  7. Set the default value of the new key to the name that should appear in Windows Explorer and other programs as the file type.
  8. 将新密钥的默认值设置为在Windows资源管理器和其他程序中作为文件类型出现的名称。
  9. Right click the new key and create a subkey DefaultIcon.
  10. 右键单击新键并创建一个subkey DefaultIcon。
  11. 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).
  12. 将新键的默认值设置为C:\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \。ico,0(0是要使用的图标的索引;如果ressource中只有一个图标,那么它必须为0。
  13. Create another new key next to DefaultIcon and call it shell.
  14. 在DefaultIcon旁边创建另一个新键,并将其命名为shell。
  15. 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.
  16. 现在,对于您想要关联的每个动词/动作,创建一个带有所需名称的新子键。有些动词是预设的,并会自动使用本地化的名称,例如:打开、编辑或打印。
  17. 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.
  18. 对于每个谓词,创建一个子键命令,并将其默认值设置为要运行的程序。还要确保包含所需的所有参数,如果内部有空格,则添加引号。“C:\我的路径\我的程序。exe”“% 1”。%1将替换为为该操作选择的实际文件名。

#2


14  

If "Open With" isn't offered, just click on "Open". If there is no default program already associated with the file type, you'll be given a choice of searching for a suitable program on the Web, or selecting a program from a list of installed programs, just as with the old "Open With".

如果没有提供“打开”,只需点击“打开”。如果没有与文件类型相关联的默认程序,您可以选择在Web上搜索合适的程序,或者从已安装程序的列表中选择一个程序,就像以前的“Open with”一样。

#3


5  

In Windows 7, you can also right click and go Properties -> General Tab and there is "Open with" and [Change] button. This way you can also set association for a new file type.

在Windows 7中,你也可以右击和go属性-> General选项卡,并且有“Open with”和[Change]按钮。这样,您还可以为新的文件类型设置关联。

#4


2  

For Windows, you can always right click and select 'Open With'. Choose the option that says select a program from a list. You can then select your own program and tell it to open files of such extension with that program by default. To change the icons, this link can help you (Change Windows icon)

对于Windows,您总是可以右键单击并选择“Open With”。选择表示从列表中选择一个程序的选项。然后,您可以选择自己的程序,并告诉它在默认情况下打开该程序的扩展文件。要更改图标,此链接可以帮助您(更改Windows图标)

#5


2  

To avoid editing the registry, instead create a new file with the desired extension. When you double-click it you will get the Can't Open dialog and you can select a program from a list of installed programs. Browse to select your desired application, add the description and check the always use the selected program. Now the extension is in the default programs list and can be further edited and changed as you are used to.

为了避免编辑注册表,应该创建一个新文件,并使用所需的扩展名。当你双击它时,你将得到不能打开的对话框,你可以从已安装的程序列表中选择一个程序。浏览以选择您想要的应用程序,添加描述并检查始终使用选定的程序。现在扩展在默认的程序列表中,可以像以前一样进行编辑和修改。

#6


1  

  1. If 'open with' is available after right clicking, it's pretty straight forward. If not...
  2. 如果“open with”是在右击后可用,这是非常直接的。如果不是……
  3. Type 'default programs' into start menu, then select 'set associations'.
  4. 在“开始”菜单中键入“默认程序”,然后选择“set associations”。

I don't know why MS decides to sometimes take away the 'open with' option...

我不知道为什么微软有时会选择“开放”选项……

#7


-1  

Probably to streamline the experience and make it easier to understand (although I don't know why they didn't keep it behind some "advanced" button for power users).

也许是为了简化体验,让它更容易理解(尽管我不知道为什么他们不把它放在“高级”按钮的后面)。

Because that's Microsoft's entire MO in general...presume that every single person that uses their software is incapable of making technical decisions. It would be so simple for them to include one little link in that Default Programs window saying "add an extension", and for that to be linked to another window where you can easily do this within a safe, GUI environment. Instead they force us to edit the registry, which is 10 times more dangerous! And if they're worried about average Joe's wrecking their computers, they could include a simple message box that informs the user of the risk!

因为那是微软的整个MO…假设每个使用他们软件的人都无法做出技术决定。对于他们来说,在默认的程序窗口中包含一个“添加一个扩展”的小链接是非常简单的,并且为了让它链接到另一个窗口,在一个安全的GUI环境中可以很容易地做到这一点。相反,他们强迫我们编辑注册表,这是危险的10倍!如果他们担心普通的乔破坏他们的电脑,他们可能会包括一个简单的消息框,告知用户风险!

Honestly MS, I've been an amateur developer for no more than 10 years, and the biggest software giant in the world can't employ programmers with more, or even an equal level of, knowledge as me?!?! So how did you get to that status in the first place?!?! It really boggles my mind!

老实说,我做了10年的业余开发者,世界上最大的软件巨头不能像我一样雇佣更多的程序员,甚至是同等程度的知识?!?!那么,你是如何从一开始就获得这种地位的呢?!?!这真让我吃惊!

Sorry for not actually adding anything constructive to the discussion but this whole perception by MS of its customers as being non-trustworthy little children really cheeses me off...and I came here in search of an answer to the same question that the OP asked, but I guess there is none (other than messing around with the registry, which I really hate doing).

很抱歉,没有给讨论添加任何建设性的东西,但这整个由她的顾客认为是不值得信赖的小孩的看法真的让我感到厌烦……我来这里是为了寻找答案,也就是OP问的那个问题,但我猜没有(除了注册表之外,我真的很讨厌这样做)。