如果改变程序图标重新编译之后看到的图标并未改变,这可能不windows缓存了之前的图标导致的,需要清除Window的图标缓存来显示正确的图标.
下面是清除Windows系统图标缓存的批处理代码:
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
致读者:本人自学编程,知识薄弱,实践经验不够,博客文章难免有错误之处,希望读者能积极指正,感激不尽。
若您有更精妙的解决方案或者对文中有疑问,欢迎留言或联系我讨论问题。