How to change the icon (icon) of a file in Windows 7 Explorer

The article describes how to change the icon (icon) for files of any type. That is, for example, a file has the doc or php extension. To the left of the file name in Windows Explorer, as a rule, there is a corresponding icon - depending on the extension of this file, i.e. depending on which file association this file belongs to and, accordingly, which program can open this file (for viewing and / or editing).

Windows XP

In Windows XP, this is easy. You need to do the following:

Explorer -> Tools - Folder options ... - File types - Select the desired extension, for example, MP3 - Advanced button - Change icon button - Browse button.

Then - find the application you need, for example:

C: \ Program Files (x86) \ Mozilla Firefox \ firefox.exe

Then click "OK" - and the icon for files of the corresponding type will be replaced with the Firefox browser icon:


Those. instead of the previous icons, the image of a "fiery fox" will appear.

Those. Windows XP (as well as Windows 98) is pretty straightforward. But what about Windows 7?

Windows 7

Unfortunately, such an easy feature was removed from Windows 7 (as well as from Windows Vista, it seems). There can be two solutions here:

    using appropriate paid and free utilities

    editing the system registry manually

About utilities. I must say, sometimes on the Internet you can find, in the literal sense, ardent wishes of all sorts of talkers about the use of certain utilities. For example, this highly recommends a utility called the Default Programs Editor.

It is quite possible that the utility (at least externally) is good and convenient. Yes, that's just an attempt to get to the official website http://defaultprogramseditor.com for some reason gives the following result (as of 10/02/2017):



The last post on this forum with a link to this program is dated 01/14/2017 (as of 02/11/1017). Hmmm ... somehow strange. Or rather, suspicious. Isn't it a "strange" utility ... Usually this kind of program is praised so fascinatingly and even, perhaps, intrusively. Anyway.

There are, of course, other utilities as well. But it seems to be better to do everything by hand. Moreover, everything is simple. And then, in fact, who knows what kind of utilities are there, what exactly do they register in the system registry ...

Consider replacing a file icon using the example of the php extension

In order to replace the icon of a certain file type (php), you need to open the registry editor, for example, regedit. Press the Start button, execute, in the window that opens, type regedit, press "OK".

The editor window opens. In it we find the line .php:



It can be seen that by default files of this type (on my computer) are opened by the PhpStorm2016.3 program. Previously, they were opened using the XWeb.php.4.0 program (the value of the backup_val parameter).

However, not for every type (extension) of files, you can find the appropriate program with which it can be opened. For example, there is no such program for the .pl extension - the value of the specified parameter is not assigned.

So, files of the php type on this computer are associated with the PhpStorm2016.3 program. Therefore, it is necessary to find this program below in the list.

To do this, go to the section

HKEY_CLASSES_ROOT \ PhpStorm2016.3

In it, in turn, you need to find the DefaultIcon section (this is the default icon for files with the php extension), i.e. go to the section HKEY_CLASSES_ROOT \ PhpStorm2016.3 \ DefaultIcon. The value is set there

E: \ Program Files (x86) \ JetBrains \ PhpStorm 2016.3.2 \ bin \ phpstorm.exe, 0



In order to set your own icon for files with the php extension, you must specify the absolute path to the corresponding file with the ico extension in the parameter value.

As an example, I took a file located in the "My Documents" directory called Telephone.ico. This is the image used as an icon for the "Contacts" section on our website, it looks like this:

This is just an example. It is clear that hardly anyone in practice would want all files in Windows 7 Explorer with the PHP extension to be displayed with icons that look like a phone. In addition, placing the image with the icon in the My Documents folder is clearly not the best solution. Of course, it is better to copy it to some more suitable one, for example, the system directory, where images for other icons are stored.

We save the previously existing value (just in case) under the name backup_value, create a new value called "Default", write the path to this image as a parameter:

D: \ My Documents \ Telephone.ico

Then we see something like the following:



In order for the changes to take effect, you must restart your computer.

After rebooting, for example, go to any folder containing files with the php extension. And here's what we can see:




The file called class.phpmailer.php (which has the php extension) now has a phone image as an icon.

Thus, for any type (i.e. for any extension) used in Windows 7, you can make any icon (icon) that you like.

Of course, it is more expedient to store files with icon images not in the “My Documents” folder, but somewhere else, so that you do not accidentally delete them later, and so that they simply do not get in the way.

Notes (edit)

In conclusion, I must say a few words about the obvious, which, however, can create obstacles:

  • The file with the icon not only must have the .ico extension, but, namely, must be either created in a program that produces files of this format (for example, Photoshop), or must be CONVERTED (!) From another format. Simple renaming (i.e. changing the extension, for example, from .png to .ico may not work - the operating system may incorrectly read such a file and it will not be displayed correctly in the place of the icon, despite the fact that in graphics programs, for example, in this file will look great in picture viewer or paint, keep that in mind.
  • After you complete the above operations, you should, as a rule, again indicate which application you plan to open the corresponding file (say, with the extension .php), first of all:

    Right click on the file name -> properties -> General -> Application (edit) -> click on the same application -> OK

    It is advisable to do this, even if the same application will be assigned to files with different extensions (for example, .php and .js)

This completes the main part of the article, if you are interested, you can read the reasoning about the reasons for the difficult change of the icon (icon) of the file in modern ones.