Windows刷新桌面缓存图标

背景

经常因为一些原因导致我的电脑(windows)桌面的快捷图标无法正常的展示,因此百度了解决方案,在此进行记录

解决方案

  • 将如下代码复制进.bat文件中,然后双击执行即可

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    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_32.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db"
    del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.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
  • 然后等待桌面加载,图标加载出来的时间有点长,需耐心等待。如果不行就重启电脑,第一次重启时间刷新时间也有点长