(ZT)clear icon cache
来源:互联网 发布:163邮箱注册软件 编辑:程序博客网 时间:2024/06/16 09:31
前言
在玩一个cm.
cm有更换exe图标的行为, 如果不是cm, 有谁会搞这么扎眼的行为, 生怕别人不知道:)
在修改了注册表中HKEY_CLASSES_ROOT\exefile\DefaultIcon值为%1后, 需要刷新系统图标.
在网上找到一个人家写好的vbs, 在winxpsp3下试了好使. 用编程实现可以借鉴这个vbs, 也可以从cm中直接扒出刷新系统图标的实现.
正确的注册表导出
Windows Registry Editor Version 5.00[HKEY_CLASSES_ROOT\exefile\DefaultIcon]@="%1"
cleariconcache.vbs
'(c) 2016 Ramesh Srinivasan.'Clears the Icon Cache databases to lets Windows rebuild them fresh.'for Windows Vista, 7, 8 and Windows 10.'Written on Jan 31 2016'Updated on Apr 01 2016'http://www.winhelponline.com/blogOption ExplicitDim WshShell, objFSO, strICPath1, strICPath2, strmsg, rtnStatus, Process, iDirtyFlags, iDirtyFlags2Const DeleteReadOnly = TrueSet WshShell = WScript.CreateObject("WScript.Shell")Set objFSO = CreateObject("Scripting.FileSystemObject")strICPath1 = WshShell.ExpandEnvironmentStrings("%LOCALAPPDATA%")strICPath2 = strICPath1 & "\Microsoft\Windows\Explorer"ExitExplorerShellWScript.Sleep(3000)ClearIconCacheWScript.Sleep(2000)StartExplorerShellSub ExitExplorerShell() strmsg = "Explorer Shell will be terminated now." strmsg = strmsg & " Please save all your work and close all programs." strmsg = strmsg & "Icon cache may not be cleared if programs are using them. Want to continue?" rtnStatus = MsgBox (strmsg, vbYesNo, "Clear the Icon Cache") If rtnStatus = vbYes Then For Each Process in GetObject("winmgmts:"). _ ExecQuery ("select * from Win32_Process where name='explorer.exe'") Process.terminate(1) Next ElseIf rtnStatus = vbNo Then WScript.Quit End IfEnd SubSub StartExplorerShell WshShell.Run "explorer.exe"End SubSub ClearIconCache() If (objFSO.FileExists(strICPath1 &"\IconCache.db")) Then On Error Resume Next objFSO.DeleteFile strICPath1 &"\IconCache.db", DeleteReadOnly On Error Goto 0 If Err.Number <> 0 AND Err.Number <> 53 Then iDirtyFlags = 1 End If End If If objFSO.FolderExists(strICPath2) Then On Error Resume Next objFSO.DeleteFile(strICPath2 & "\icon*.db"), DeleteReadOnly On Error Goto 0 If Err.Number <> 0 AND Err.Number <> 53 Then iDirtyFlags2 = 1 End If End If WshShell.Run "ie4uinit.exe -ClearIconCache" WshShell.Run "ie4uinit.exe -show"End SubIf iDirtyFlags = 1 Then rtnStatus = MsgBox ("Some programs are still using the IconCache.db in LOCALAPPDATA. Close all programs and try again", vbOKonly, "Clear the Icon Cache")End IfIf iDirtyFlags2 = 1 Then If iDirtyFlags <> 1 Then rtnStatus = MsgBox ("Some programs are still using the cache in Location 2. Close all programs and try again", vbOKOnly, "Clear the Icon Cache") End IfEnd IfIf iDirtyFlags = 0 And iDirtyFlags2 = 0 Then MsgBox "Successfully cleared the Icon Caches.", vbOKOnly, "Clear the Icon Cache"End IfSet WshShell = NothingSet objFSO = Nothing
0 0
- (ZT)clear icon cache
- (ZT)Icon资源网站
- ofbiz distributed cache clear
- ofbiz distributed cache clear
- Clear IIS cache
- Cache Clear API
- How to clear UIWebView cache?
- Clear the SharePoint Configuration Cache
- How to clear Java cache
- Drupal7 truncate/clear all cache
- couldn't clear tomcat cache
- difference between clear data and clear cache ? Android
- How To Clear A Browser Cache
- cache of the Session flush clear
- Linux inode cache机制分析 (zt)
- Page cache和buffer cache的区别与联系(ZT)
- Web: Clear cache data for a client page
- How To Clear BNE Cache (文档 ID 1075840.1)
- 过拟合
- maven:资源过滤的介绍
- RabbitMQ消息队列知识点归纳
- 用python创建桌面应用(二)
- SVN简单概述
- (ZT)clear icon cache
- 颜色矩原理及C++实现
- 集合框架-泛型接口的概述和使用
- Android 人品计算器
- 第三十九讲项目一 判断n是否是完数
- 电商秒杀系统设计分析
- PPTP源码流程分析图
- EL表达式中获取list长度
- Linux下SD卡驱动移植