28

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".

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

Peter
  • 1,292
  • 4
  • 15
  • 33
  • 2
    @Brad Larson: Sorry, but this is clearly not OT. If file association problems are not related to programming & development, I don't know what is. And even if thispost was OT, you should reconsider purely on the basis of all the users and the ~31K views! – not2qubit Apr 01 '14 at 10:09
  • @user1147688 - No, it's not a problem with actual code or programming. Questions about keyboards and monitors (which are things that programmers need, too) are off topic for the same reason. Popularity of a question does not mean that it's on topic. – Brad Larson Apr 01 '14 at 14:29

7 Answers7

39

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. 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.
Sled
  • 18,541
  • 27
  • 119
  • 168
Mario
  • 35,726
  • 5
  • 62
  • 78
  • I have accepted this as the answer, thank you Mario. But why did MS do this? Not very helpful of them ... – Peter Feb 01 '12 at 09:50
  • 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). The old dialog could be overwhelming for unexperienced users (and had stuff most people never used like DDE settings), but cutting it as a whole was most likely a bad idea. Btw. it was cut in Windows Vista already, not just Windows 7. – Mario Feb 01 '12 at 09:59
  • Nice one. Let me mention that the second key is not a subkey of the first one ;) It's probably safest to let explorer create all those keys (with the "Open With..." Dialog) and then just modify them, but this guide helps to know where to look for what :) – SvenS Nov 16 '12 at 10:12
  • Another reason for the program of choice not appearing in the 'open with' dialogue box is that the software hasn't created an entry in the register properly when it was installed. I had this issue with a 'plug and play' version of RStudio (essentially a .zip file that you just had to unzip to use) - it did not create an entry in the registry and I was unable to associate the relevant file types (none of the solutions involving regedit worked). The only thing that did work was re-installing the program using the installer instead of the plug and play version. – Amy M Mar 01 '17 at 13:57
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".

Geoff
  • 141
  • 1
  • 2
  • I think this really is the correct answer. No need for a registry hack, nice and simple. – Simon Elms Jan 18 '14 at 12:46
  • This is the ABSOLUTELY correct answer! – Craig May 21 '14 at 18:10
  • 2
    This doesn't produce the select a program dialogue for me. It just shows an error saying "This file does not have a program associated with it for performing this action. Please install a program or, if one is already installed, create an association in the Default Programs control panel." And the control panel doesn't have any option to create a new file type association - just change existing ones. Terrible usability. – Archonic Oct 15 '14 at 03:50
  • It permits assigning an application to open a file type, but doesn't help with setting the ICON for that file type. – Peter Apr 21 '15 at 14:39
  • This is it. Thanks a lot! – Jaime de los Hoyos M. Sep 09 '16 at 12:44
  • No need for getting into the registry, this does it nice and simply – boardtc Feb 08 '17 at 12:13
8

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.

lzisko
  • 81
  • 1
  • 1
  • lzisko and Geoff had the most useful answers. Some employers now won't let their employees have access to edit the registry. I also found that Notepad (which I am reduced to using for the moment) is not in the Control Panel's list of programs with which an extension can be associated (Windows 7) –  Oct 01 '13 at 14:42
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.

Michael
  • 63
  • 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)

Yanki Twizzy
  • 7,771
  • 8
  • 41
  • 68
  • I think this is a better answer. If the Open With is not available then just select Open and select a program. From that point forward it is associated. No need to dig into the registry. – Gene S Dec 04 '14 at 14:48
1
  1. If 'open with' is available after right clicking, it's pretty straight forward. If not...
  2. Type 'default programs' into start menu, then select 'set associations'.

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

  • The option is only there if Windows knows of any program that can open the file. Not all files types are associated with a program in the first place. – Armen Michaeli Mar 30 '20 at 14:55
-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!

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!

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

Kenny83
  • 769
  • 12
  • 38
  • 1
    The programmers they employ often do really know their stuff, but Microsoft, as you mentioned, assumes their users can't make technical decisions. That is because when you are a massive company that sells to the majority of the world, you have to pander to the lowest denomination. The displeasure you have from Microsoft doing this is the displeasure of the intelligent surrounded by the ignorant, and those who pander to the ignorant. The fact of the matter is, there is more money to be had from the dumb then the wise. And so, to sell to the wise would be dumb. – CamelopardalisRex Sep 18 '13 at 18:51
  • 1
    Counterpoint: Power users know or can quickly discover all the workarounds, and either find or write scripts to automate what UIs do. Microsoft gets advanced users complaining about unnecessary UI, and then other advanced users complaining when they remove it; they're in a no-win situation and always will be. – SilverbackNet Apr 03 '14 at 02:53
  • The problem with @SilverbackNet's argument (as valid as it may be) is that some of us are technical enough to avoid using Windows as much as possible, but then when we have to, everything's a convoluted, multi-stepped, download-commerical-software-for-stuff-Linux-does-for-free, clustersmeg. (As a result, I once saw a colleague throw a laptop in frustration. The boss' response? 'Oh—it was the Windows laptop? Just expense out a replacement.') And 'unnecessary UI' can be worked around if there's command line support. I hear the shell doesn't suck so much anymore. – Michael Scheper Jul 15 '15 at 21:19
  • How do you think non-Linux people feel when they step into Linux? You have to look for and build a combination of software that may or may not build cleanly on current toolchains (if it ever did) for something that was a turn-key solution before. That's how moving systems is, you have to adjust expectations and become fluent. – SilverbackNet Jul 15 '15 at 23:57