Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

This Super User Question described several methods how associate some specific program with file type. Now I want to know if there is a method to set a specific icon to files with a specific extension?

I.e. If we have file extension .myext and program MyProg, we need to set for all files with .myext icon of MyProg

I tried the methods described in the other question (Especially method with ASSOC) on Vista and Windows 7, but the file does not got icon

share|improve this question
1  
+1 for searching about your problem at first, and asking your own question then, linking to other questions, and explaining what worked or not. I wish all new users would act this way. –  Gnoupi Jun 29 '10 at 7:33
add comment

1 Answer

Yes you can associate. (Otherwise icons would be limited to what Windows Explorer knows about.)

It is done in the registry.

Navigate to and expand HKEY_CLASSES_ROOT and create a key for your extension. Within this key create the default value with a name for the file type.

Again under HKEY_CLASSES_ROOT create a key for the file type. Under the file type key create a new key "DefaultIcon" and in that create the default value. This value should be either a path to an icon file, or to a exe/dll and a resource index.

Take a look at the registration for known file types already there to see how it is done. (There will also be other keys and values to cover launching the right program, COM (component object model) and other things associated with file types, you can ignore these.)

share|improve this answer
    
Thanks , it helps –  user37137 Jun 29 '10 at 10:05
    
How do you get the icons to display after you edit the registry? I just get generic icons –  endolith Aug 4 '11 at 0:34
1  
@endolith Everything (path, resource id (if applicable), icon format, ...) needs to be 100% correct – there is no room for error. Just keep checking and validating. Also starting with something really simple (even if it won't be what you finally want) to get something, anything, working. –  Richard Aug 4 '11 at 5:51
    
Does it change immediately, though ? Do you have to restart something or reboot? –  endolith Aug 4 '11 at 14:10
1  
@endolith: I seem to recall the effect was immediate, except a current view won't refresh itself, navigate to another folder to see the new icon (a couple of folders each with the right kind of file). But I've not needed to do this often enough that I would be completely confident that a logoff & on wouldn't be needed. –  Richard Aug 4 '11 at 15:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.