Windows XP was the last Windows system to have
File Types tab in the
Folder Options applet and to allow user easily changing default icon for particular file extension. This tab was replaced in Windows Vista and following systems by
Default Programs applet from Control Panel. It lacks many features, including changing icons for file types. Therefore, in Windows systems following Windows XP you have to either use 3rd party software for achieving this simple task or dig in Windows Registry. This isn’t that hard task as it seems, so read on, if you want to give this method a try.
First of all, you have to write down full path to icon you want to use as some file type’s default icon and optionally icon’s index. If you’re using a separate icon, stored in
.ico file, then you only need to path to that file. Try to put it into some “safe” location, like
C:Windows folder, from which it will not be deleted accidentally. If you want to use one of icons embed into
.dll file, you need both path and icon index.
If you want to use one of system icons, then you have to use
shell32.dll file. It is located in
C:WindowsSystem32 folder, if your Windows has been installed in
C:Windows folder. However, for using icons from this file, file name is all you need, as files stored in system folder are recognized without full path across entire system. You only need an full path to icon file, when you’re using file stored in some custom location.
To easily write down path and icon index, you can use icon picker dialog. To launch it, right-click on a any folder in your system, click
Properties, switch to
Customize tab and click
Change Icon... button. If using system icons, then
shell32.dll file will already be open. If you want to use icon from another
.dll file, make use of
Browse... button and locate desired file. Copy file’s path and paste it into Notepad or somehwere else.
Now, you only need to write down index of your favourite icon. They’re indexed in icon picker dialog from top to bottom, then to the next column, again from top to bottom and so on. So, if you want second icon in second column, then its index will be
6, as you have four icons from top to bottom in first column, then first icon in second column have index
5 and under index
6 is your icon. You need to subtract
1 from column number and then multiply it times 4. And you need to subtract 1 from icon position in that column and sum both numbers. I wanted to use icon which appears in my
shell32.dll file in 18th column at 3rd position. Therefore, formula for calculating my icon’s index was:
((18 - 1) * 4) + (3 - 1). This way, it turned out, that my favourite icon has index
Having both file path and icon index you can start digging in Windows Registry:
1. Start Windows Registry, by clicking
Start button, typing
regedit.exe and pressing Enter.
2. Expand first tree node (
HKEY_CLASSES_ROOT) and locate your file type’s extension under it. I wanted to change default icon for all my PHP files, so I located
HKEY_CLASSES_ROOT.php tree node. Note, that
HKEY_CLASSES_ROOT tree node is enormously huge, containing thousadns of sub nodes, so it may take you some time until you find something in it. Alternatively, you can press Ctrl+F or select
Edit > Find... and make use of Windows Registry’s search tool.
3. Write down extension’s Prog ID, which is displayed as
(default) key value, in the right pane, once you select file’s extension in the left pane. You can double click
(default) key and copy Prog ID from opened window.
4. In the left pane locate and expand
HKEY_CLASSES_ROOTProgIDDefaultIcon tree node, replacing
ProgID with Prog ID written down in previous step. If you copied Prog ID in previous step, you may again use search tool. It was
HKEY_CLASSES_ROOTphp_auto_fileDefaultIcon in my case. If
DefaultIcon node does not exist under
HKEY_CLASSES_ROOTProgID node, then you have to manually create it. Select Prog ID in left pane, select
Edit > New > Key from menu, enter
DefaultIcon name and confirm hitting Enter.
5. Double click
(default) key in
DefaultIcon node and enter as value file name with optional path to it and optional icon index, after comma, without space. In my case, entire value to be entered was
shell32.dll,72 as I wanted to assign 72th icon from system
shell32.dll file as default icon for all
php_auto_file) files in my system.
Note, that some guides may mislead you into creating
DefaultIcon key directly under your extension’s key in Windows Registry (
.php in this example). This will work only in certain situations (for so called file-type assignments). But, for most of them (so called application assignment) this will not work. You’ll find some details in this MSDN document. However, it contains a lot of developer’s mumbo-jumbo.
You’re done. Exit Windows Registry and either restart your system (if you’re lazy) or force icon cache rebuild (if you like the hard way or you have to many programs opened and can’t afford for system restart at that point).
The fastest way to refresh icons in Windows Explorer is to restart. To do this:
1. Ctrl+Alt+Del and click
Run Task Manager or click
Start button, type
taskmgr.exe and press Enter.
2. Switch to
Process tab, right-click on the
explorer.exe item and select
End Process or select it and hit Del. Confirm operation.
New Task (Run...) from the
File menu in Task Manager, type
explorer.exe and press Enter.
Check, if you see new icon for your newly changed file extension.
Rebuilding icons cache
If above solution does not bring desired results, then you need to rebuild icons cache. To do this, you need to follow above steps, but after your end
explorer.exe and before you start it, you need to do following:
New Task (Run...) from the
File menu in Task Manager, type
cmd.exe and press Enter.
2. In console execute these three commands, hitting Enter after each to confirm:
cd /d %userprofile%AppDataLocal
del IconCache.db /a
3. Now, restart Windows Explorer, using Task Manager, as in above instruction (
New Task (Run...) >
explorer.exe > Enter).
That should finally give you your desired icon next to every file of changed extension.
Some programs (like Total Commander) have their own icon’s cache and therefore you need to restart them as well to see changes in them.