2009年1月7日 星期三

CleanIECacheData清除IE內部暫存資料

下面文字,複製並貼上於Notepad後,另存成VBS檔案格式
Option Explicit
Dim WshShell, RegIEv1 ,ShellCmd
Set WshShell = WScript.CreateObject("WScript.Shell")
RegIEv1 = "HKLM\Software\Microsoft\Internet Explorer\"
Const TIMEOUT = 5

'Check the version of IE & Clean all cache data
If Left(WshShell.RegRead(RegIEv1 & "Version"),1) >= 7 Then
' WshShell.Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 1")
' WshShell.Run("rundll32.exe InetCpl.cpl,,ClearMyTracksByProcess 2")
' WshShell.Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 8")
' WshShell.Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 16")
' WshShell.Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 32")
WshShell.Run("rundll32.exe InetCpl.cpl,ClearMyTracksByProcess 255")

'launch IE
WshShell.Run """C:\Program Files\Internet Explorer\iEXPLORE.EXE""",1,true
else

WshShell.Run "cmd /K c: & \DelIE6Cache.bat",2,true
WshShell.Run """C:\Program Files\Internet Explorer\iEXPLORE.EXE""",1,true


'Try to delete via manual
'因上面功能僅支援IE7以上,故IE6需手動刪除
'WshShell.Popup ("Only support IE7 or above !"),TIMEOUT, WScript.ScriptName, vbInformation
'@FOR /D %%A IN ("C:\Documents and Settings\*.*") DO DEL /S/Q/F "%%A\Cookies\*.*"
'@FOR /D %%A IN ("C:\Documents and Settings\*.*") DO DEL /S/Q/F "%%A\Local Settings\Temp\*.*"
'@FOR /D %%A IN ("C:\Documents and Settings\*.*") DO DEL /S/Q/F "%%A\Local Settings\History\*.*"
'@FOR /D %%A IN ("C:\Documents and Settings\*.*") DO DEL /S/Q/F "%%A\Local Settings\Temporary Internet Files\*.*"

End If

WScript.quit
set WshShell = nothing

參考資料來源

相關參考資訊

相關工具:
(開放源碼)BleachBit,可清除IE之Cookies,History,Temporary files