正确清理 Win7/Win10 系统图标缓存

2018年8月26日00:55:40 评论 4,399 views

某些时候我们会给一些程序更换一些图标,或者有可能下载一个程序的新版本图标发生变更了。但是在 Win7 或者 Win10 系统中我们发现给程序更换了图标或者重新下载的文件图标并没有改变,这其实是 Windows 的图标缓存在作祟。我们可以通过即时清理图标缓存的方式来让我们更换的图标“生效”。

将一下代码保存为批处理,双击运行即可清理图标缓存,此批处理经过小斑马修改,完善了 Win10 一些环境清理图标缓存不生效的情况。

rem 关闭Windows外壳程序explorer
taskkill /f /im explorer.exe

rem 清理系统图标缓存数据库
attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db"
del /f "%userprofile%\AppData\Local\IconCache.db"
attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_16.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_48.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_768.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1280.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1920.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_2560.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_custom_stream.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_exif.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_wide.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_wide_alternate.db"

del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_16.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_32.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_48.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_96.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_256.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_768.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_1280.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_1920.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_2560.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_custom_stream.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_exif.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_idx.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_sr.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_wide.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\iconcache_wide_alternate.db"

rem 清理系统托盘记忆的图标
echo y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v IconStreams
echo y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStream

rem 重启 Windows 外壳程序 explorer
start explorer


  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin