重建图标缓存的两个脚本-bat下令和vbs文件

重建图标缓存的两个脚本--bat命令和vbs文件

第一个是用bat批处理命令,可以正常执行

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

第二个是vbs文件,提示错误,希望懂得vb的同学给我指正....

On Error Resume Next
If MsgBox("将关闭所有打开的资源管理器窗口,并重建图标缓存。" _& vbCrLf & "是否继续?",vbYesNo+vbQuestion,"询问")= vbNo Then
Wscript.Quit
End If
Set FSO = CreateObject("Scripting.FileSystemObject")
FSO.DeleteFile(FSO.GetSpecialFolder(0) & "\shelliconcache")
Set FSO = Nothing
Set Pros = GetObject("winmgmts:\\.\root\cimv2").ExecQuery ("Select * from Win32_Process Where Name = 'explorer.exe'")
For Each Pro in Pros
Pro.Terminate
Next
Set Pros = Nothing
MsgBox "操作已完成。",vbInformation,"提示"

提示的错误是

重建图标缓存的两个脚本-bat下令和vbs文件