Jump to content

how to delete the temp internet files


Recommended Posts

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)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...