Sign in to follow this  
Followers 0
JimmyCollins

how to delete the temp internet files

2 posts in this topic

Hi,

Does any one know how to clear the Temporary Internet Files using AutoIT?

These are not files, but links to files?

Thanks,

JC

Share this post


Link to post
Share on other sites

This may not be the best way, but works.

$StageFlags = 'StateFlags0100'
$loop = 0
$RegRootkey = 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\explorer\VolumeCaches'

While 1
    $loop += 1
    $Regkey = RegEnumKey($RegRootkey,$loop)
    If @error <> 0 then ExitLoop
    If $Regkey = 'Internet Cache Files' Then 
        RegWrite($RegRootkey & '\' & $Regkey, $StageFlags, 'REG_DWORD', 2)
    Else
        RegWrite($RegRootkey & '\' & $Regkey, $StageFlags, 'REG_DWORD', 0)
    EndIf
    ConsoleWrite('Registry Key : ' & $Regkey & @LF)
WEnd

RunWait('cleanmgr.exe /sagerun:100')
$loop = 0
While 1
    $loop += 1
    $Regkey = RegEnumKey($RegRootkey,$loop)
    If @error <> 0 then ExitLoop
    RegDelete($RegRootkey & '\' & $Regkey, $StageFlags)
WEnd

Or...

You can convert this ScriptingGuys script to AutoIt.

Const TEMPORARY_INTERNET_FILES = &H20&

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES)
Set objFolderItem = objFolder.Self
strPath = objFolderItem.Path & "\*.*"

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile(strPath)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0