找回密码
 加入
搜索
查看: 3263|回复: 5

请问如何清空Temporary Internet Files

[复制链接]
发表于 2009-4-29 13:12:09 | 显示全部楼层 |阅读模式
请问如何清空Temporary Internet Files文件夹里的所有文件呀
FileDelete("C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\*.*")
无效
DirRemove("C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files")
也无效
发表于 2009-5-25 07:32:48 | 显示全部楼层
发表于 2009-5-25 07:33:03 | 显示全部楼层
00000000000
发表于 2009-5-25 15:28:45 | 显示全部楼层
run("RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8")
发表于 2009-5-25 18:28:42 | 显示全部楼层
FileDelete ( "C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" )
这个貌似也行
发表于 2009-5-25 19:21:14 | 显示全部楼层
来个调用API的,可以删除指定或清空所有的临时文件。
#include <Date.au3>
#include <Array.au3>

CONST $tagCacheEntry = "dword Size;ptr Src;ptr Local;dword Type;dword UseCount;" & _
                "dword HitRate;dword SizeLow;dword SizeHigh;dword Modify[2];" & _
                "dword Expire[2];dword Access[2];dword Sync[2];ptr Header;dword HeaderSize;ptr Ext"

_DeleteUrlCacheEntry()


Func _FindFirstUrlCacheEntry()
        Local $hFind, $tCache, $pCache

        $hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
                        "str", "", "ptr", 0, "int*", 0)
        $tCache = DllStructCreate("ubyte[" & $hFind[3] & "]")
        $pCache = DllStructGetPtr($tCache)
        $hFind = DllCall("Wininet.dll", "hWnd", "FindFirstUrlCacheEntry", _
                        "str", "", "ptr", $pCache, "int*", $hFind[3])
        Return $hFind[0]
EndFunc        ;==>_FindFirstUrlCacheEntry()


Func _FindNextUrlCacheEntry($hFind)
        Local $iResult, $tCache, $pCache, $tBuffer, $pBuffer, $aResult[9]

        $iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
                        "hWnd", $hFind, "ptr", 0, "int*", 0)
        If $iResult[3] = 0 Then Return SetError(1, 0, $aResult)
        $tBuffer = DllStructCreate("ubyte[" & $iResult[3] & "]")
        $pBuffer = DllStructGetPtr($tBuffer)
        $iResult = DllCall("Wininet.dll", "int", "FindNextUrlCacheEntry", _
                        "hWnd", $hFind, "ptr", $pBuffer, "int*", $iResult[3])

        Local $tSrc, $tLocal, $tHeader, $iHeaderSize
        $tCache = DllStructCreate($tagCacheEntry, $pBuffer)
        $tSrc = DllStructCreate("char[256]", DllStructGetData($tCache, "Src"))
        $tLocal = DllStructCreate("char[260]", DllStructGetData($tCache, "Local"))
        $iHeaderSize = DllStructGetData($tCache, "HeaderSize")
        $tHeader = DllStructCreate("char[" & $iHeaderSize & "]", DllStructGetData($tCache, "Header"))
        $aResult[0] = DllStructGetData($tSrc, 1)
        $aResult[1] = DllStructGetData($tLocal, 1)
        $aResult[2] = DllStructGetData($tCache, "Type")
        $aResult[3] = DllStructGetData($tCache, "SizeLow")
        $aResult[4] = _FormatTime(DllStructGetPtr($tCache, "Modify"))
        $aResult[5] = _FormatTime(DllStructGetPtr($tCache, "Expire"))
        $aResult[6] = _FormatTime(DllStructGetPtr($tCache, "Access"))
        $aResult[7] = _FormatTime(DllStructGetPtr($tCache, "Sync"))
        $aResult[8] = DllStructGetData($tHeader, 1)

        $tSrc = 0
        $tCache = 0
        $tLocal = 0
        $tHeader = 0
        Return SetError(Not $iResult[0], 0, $aResult)
EndFunc        ;==>_FindNextUrlCacheEntry()


Func _FindCloseUrlCache($hFind)
        Local $iResult
        $iResult = DllCall("Wininet.dll", "int", "FindCloseUrlCache", "hWnd", $hFind)
        Return $iResult[0] <> 0
EndFunc        ;==>_FindCloseUrlCache()


Func _DeleteUrlCacheEntry($sUrlPattern = "")
        Local $iResult, $hFind, $aUrl

        $hFind = _FindFirstUrlCacheEntry()
        While True
                $aUrl = _FindNextUrlCacheEntry($hFind)
                If @error Then ExitLoop
                If $sUrlPattern = "" Or StringRegExp($aUrl[0], $sUrlPattern) Then
                        _Wininet_DeleteUrlCacheEntry($aUrl[0])
                EndIf
        WEnd
        Return _FindCloseUrlCache($hFind)
EndFunc        ;==>_DeleteUrlCacheEntry()


Func _Wininet_DeleteUrlCacheEntry($sUrl)
        Local $iResult
        $iResult = DllCall("Wininet.dll", "int", "DeleteUrlCacheEntry", "str", $sUrl)
        Return $iResult[0] <> 0
EndFunc        ;==>_Wininet_DeleteUrlCacheEntry()



Func _FormatTime($pTime)
        Local $tSysTime
        $tSysTime = _Date_Time_FileTimeToSystemTime($pTime)
        Return _Date_Time_SystemTimeToDateTimeStr($tSysTime)
EndFunc        ;==>_FormatTime()

评分

参与人数 3金钱 +45 收起 理由
星雨朝霞 + 30 好东西啊!谢谢分享
you6591098 + 10 完全看不懂 跟看天书一样啊
lynfr8 + 5 厉害、佩服

查看全部评分

您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-25 13:56 , Processed in 0.080388 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表