How to rebuild the icon cache in Windows

  • By Christopher Kielty, last updated May 8, 2018

If a bunch of the files on your Windows PC have suddenly started looking like generic icons or are maybe showing the wrong icon, it may be time to reset the icon cache. To do this, we’re going to use the Windows command line. Haven’t used the command line very much before? Don’t worry, the process is relatively easy and each step is explained.

We’ll go over the process for XP, Vista, and Windows 7. Resetting the cache is actually almost identical between different versions of Windows. To do this, you’re going to need to be logged into an account with administrative privileges.

As usual, please make sure you have all of your data backup up before proceeding.

See also: How to recover lost disk space on a usb thumb drive

Getting into the command line

First, save and close all running programs. Then, fire up the Windows command line. There are several ways to get to a command prompt. Try this:

Start –> All Programs –> Accessories –> Command Prompt

If you don’t see “Command Prompt” listed in accessories, try:

Start –> Run, then type “cmd” (without the quotes, of course) and hit enter.

Interesting side note: We could also type “command” into the Run prompt, instead of “cmd”. This would bring up a legacy DOS command prompt that’s good for running older software. For our purposes, however, lets stick with “cmd”.

Ok, by now all other programs should be closed and we should have a command prompt up and running. As we go though each of these steps, all of the commands we’re using will be explained. However, for more information about each command, Microsoft maintains a pretty darn good reference.

Close explorer.exe using the “taskkill” command. Don’t worry, we’ll reopen Explorer at the end of this guide to complete the process.

taskkill /im explorer.exe /f

“taskkill” is the command we’re using to close Explorer. “/im” means we want to identify explorer by its image name which is “explorer.exe”. The “/f” at the end of the command means we want to force Explorer to close. Without “/f”, it won’t actually close (it’s stubborn like that).

Find IconCache.db

Most of this process is the same between Windows XP, Vista, and 7. The primary difference is in locating the IconCache.db file. Windows seems to like making changes to it’s directory structure with new versions.

In Windows XP, the file we want is located here:

C:\Documents and Settings\<**USER NAME**>\Local Settings\Application Data

In Windows 7 and Vista, IconCache.db is located here:

C:\Users\<**USER NAME**>\AppData\Local

Use cd to navigate to the directory where the IconCache.db file is kept. Because writing out that whole path would involve an awful lot of typing, we can use folder variables instead.

In XP, do:

cd  /d %userprofile%\Local Settings\Application Data

In Windows 7 and Vista, do:

cd /d %userprofile%\AppData\Local

Alternatively, we could use “%LOCALAPPDATA%”, which should take us right where we need to go on XP, Vista, and 7. Pretty neat, right?

cd /d %localappdata%

Unhide IconCache.db and rename it to create a backup

Use “attrib” to unhide the IconCache.db file.

attrib -h IconCache.db"

“-h” means we’re unhiding the file. Running the same command with “+h” would cause the file to become hidden again.

Use “ren” to rename IconCache.db to IconCache.db.backup

ren IconCache.db IconCache.db.backup

Unhiding and renaming the file isn’t absolutely necessary. However, this handily provides us with a backup should something go wrong.

Restart Explorer to rebuild the cache

Restart explorer from the command line by typing:


All done! Your icons should be back to normal now.

What the folder variables mean in Windows XP

  • %LOCALAPPDATA% = C:\Documents and Settings<USER NAME>\Local Settings\Application Data
  • %USERPROFILE% = C:\Documents and Settings<USER NAME>

What the folder variables mean in Windows 7 and Vista

  • %LOCALAPPDATA% = C:\Users<USER NAME>\AppData\Local

Still having problems? Drop us a line! We’re happy to help!