I couldn’t find an easy way to clear the icon cache so I developed this little batch script to make it easy. A simple batch script to clear the icon cache introduced in Windows Vista. Now updated to work on all current versions of Windows, for real this time.
A side note before trying this script try using either ie4uinit -show in Windows 10 or ie4uinit -ClearIconCache in Windows 7. These commands are supposed to clear the icon cache and will do so without requiring you to terminate explorer or reboot you computer.
Download: clear-icon-cache.bat (zipped)
SHA3-256: ddd83421b246333f42be070adcbc97915cce0ae927046202e151e9a4f296fe58
:: Icon Cache Clearer by Furgelnod of furgelnod.com
@echo off
title Icon Cache Clearer by Furgelnod
echo This script is to be used as a last resort. It will manually erase the icon cache.
echo:
echo Please first try these simple methods that will not require terminating explorer or rebooting.
echo In Windows 10 run: "ie4uinit -show"
echo In Windows 7 run: "ie4uinit -ClearIconCache"
choice /C YN /m "Continue"
if %ERRORLEVEL% EQU 2 goto :EOF
set "NotEightPlus=0"
set "EightPlusCachePurged=0"
set "CachePurged=0"
pushd "%localappdata%\Microsoft\Windows\Explorer"
forfiles /M "iconcache*.db">nul
if ERRORLEVEL 1 (
if not exist IconCacheToDelete (
set "NotEightPlus=1"
) else (
set "EightPlusCachePurged=1"
)
)
pushd "%localappdata%"
if not exist IconCache.db (
set "CachePurged=1"
)
if %CachePurged% EQU 1 (
echo:
echo IconCache.db is missing. It will be recreated the next time you reboot.
if %NotEightPlus% EQU 1 goto QST
if %EightPlusCachePurged% EQU 1 (
echo The iconcache files introduced in Windows 8.1 are missing. They too will be recreated the next time you reboot.
goto QST
)
)
echo.
echo Do you wish to continue to clear the icon cache?
echo Explorer will be terminated in the process.
echo.
choice /C YN /m "Continue"
if %ERRORLEVEL% EQU 2 goto :EOF
taskkill /IM explorer.exe /F > nul
if %CachePurged% NEQ 1 (
del /F /a "IconCache.db" > nul
)
if %NotEightPlus% NEQ 1 (
if %EightPlusCachePurged% NEQ 1 (
popd
forfiles /M "iconcache*.db" /C "%COMSPEC% /C del /F /a @path" >nul
)
)
start explorer.exe
echo.
echo Icon Cache is now cleared.
echo.
echo Please restart your computer for the cache to be completely rebuilt.
:QST
echo.
choice /C YN /m "Restart the computer now"
if %ERRORLEVEL% EQU 2 goto :EOF
shutdown /r /t 0
Icon cache in windows 8 and 10 is stored in C:\Users\\AppData\Local\Microsoft\Windows\Explorer which contains:
• iconcache_16.db
• iconcache_32.db
• iconcache_48.db
• iconcache_96.db
• iconcache_256.db
• iconcache_768.db
• iconcache_1280.db
• iconcache_1920.db
• iconcache_2560.db
• iconcache_custom_stream.db
• iconcache_exif.db
• iconcache_idx.db
• iconcache_sr.db
• iconcache_wide.db
• iconcache_wide_alternate.db
Seems that you are somewhat correct Windows 8.1 and above introduced these databases located at “%LOCALAPPDATA%\Microsoft\Windows\Explorer” in addition to the original iconcache.db in that root. At some point I’ll update the script to check for and also remove these (edit: done).