forever geeks
  • Home
  • Author
  • Links
  • Archives

How To Clean Temporary Internet Files With A Log Off Script

The temporary Internet Files folder on your computer is a dynamic place, every time you visit a website on the Internet, all the web files composing that website get transferred from the hosting server to your computer Temporary Internet Files folder. that includes audio files, pictures and documents. so if you surf a lot on the Internet that Temporary Internet File folder get’s big. I believe there is a size limit on how much this folder can grow, on Windows XP that size is 252 MB. if you want to see the settings for this folder click on Start then Control Panel then click on Internet Options and beneath Browsing History click on Settings:

temporary Internet Files

From this window you can change the settings on how the Temporary Internet Files behave, and as you can see, you also have the options to not cache anything, that means that every time you visit a website, a fresh copy of the web files will be downloaded onto your computer, this is not good for speeding reasons. most people have websites that they visit frequently, the caching feature speed up the loading process by not requesting a new fresh of copy of the web files, but instead uses the files already on the temporary Internet files, that’s why normally loading a website for the first time takes longer.

another issue I have noticed with the Temporary Internet files is that keeps the Anti-virus scan busy on your computer, especially when it has grown big. because it is such a dangerous folder the antivirus scan everything that get’s loaded to this folder, when the folder has too many files, the scan normally takes longer, thus degrading the performance on your system.

Dude, where is the Script?

OK. so the best way to clean the Temporary Internet files is by using a log off script. every time you shutdown your computer, the script will clean up the temporary Internet files, so it does not grow too big, and the antivirus does not spend too much time scanning it.  the script that does the job beautifully is this:

Const TEMPORARY_INTERNET_FILES = &H20&
dim intDepth
Set objShell = CreateObject(”Shell.Application”)
Set objFSO = CreateObject(”Scripting.FileSystemObject”)
‘Clean User Temporary Intenet Files
Set objNameSpace = objShell.Namespace(TEMPORARY_INTERNET_FILES)
Set objFolderItem = objNameSpace.Self
set objFolder=objFSO.GetFolder(objFolderItem.Path)
intDepth=0
RemoveFolder objFolder
‘Clean User Temp Files
Const TemporaryFolder = 2
Set tempFolder = objFSO.GetSpecialFolder(TemporaryFolder)
RemoveFolder tempFolder
sub RemoveFolder(objFolder)
    ‘ Recursively remove files and folders
    intDepth=intDepth+1
    on error resume next
    for each objFile in objFolder.Files
        objFile.Delete true
    next
    Err.Clear
    on error goto 0
    for each objSubfolder in objFolder.SubFolders
        RemoveFolder objSubFolder
    next
    intDepth=intDepth-1
    if intDepth<>0 then’ Don’t delete top-level folder
        on error resume next
        objFolder.Delete true
        err.Clear
        on error goto 0
    end if
end sub

I must add that I did not write this script, but I know much about scripting that I know what is doing. I don’t remember quite well where I found the script, but if someone wants to take credit for it, say it on the comments.

download the file attached 

Clean-up Temporary Internet Files Script

once you download this files click on Start then Run and type gpedit.msc and click on OK. the Group Policy window should come up:

 group policy

under the User Configuration option, expand the Windows Settings folder, then click on Scripts ( logon/Log off ) then on the right panel click on Log off to open up the properties:

log off properties

click on the Add tab. under the Script Name browse to the location where you downloaded the file attached above. leave blank for Script Parameters.

adding the script

click on Ok. click on OK on the log off window properties also. close out of group policy and restart your computer to see if the script is working. when you shutdown the computer it should say “Running log off script” after the computer restarts, check the temporary Internet files folder to see if its clean.

that’s it, you don’t have to worry about the Temporary Internet Files anymore (:)


Related Articles:

Internet Explorer Page Cannot Be Display Error

Increase Offline Files 2 GB Storage Limit

How To Transfer Files From Windows XP to Windows 7

How To Delete Files Being Used By Another Person Or Program ?

the trust relationship between this workstation and the primary domain failed

Add/Remove Windows Component Error

Prevent Programs Running At Start-Up Script

Use T-mobile Dash as a Modem To Access The Internet From PC


No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

If you want to leave a feedback to this post or to some other user´s comment, simply fill out the form below.

(required)

(required)


  • Popular Stuff

    • How To Connect To a Wireless Access Point in Windows 7
    • How To Setup A Wireless Profile On Windows 7
    • Why is Seaport.exe process running on my Computer?
    • Change Product Key On Windows Server 2008
    • Import Contacts From Palm Desktop To Iphone
    • Outlook Automatic synchronization
    • the trust relationship between this workstation and the primary domain failed
    • Windows 7 Minimum Requirements
    • VMware Server 2.0 Username And Password
    • Convert VMDK VMware to VHD Virtual Server Files
    • Split .PST files into smaller files
    • Printer not printing document correctly
  • Latest Posts

    • Is Your Computer Windows 7 Ready?
    • Choosing The Right Windows 7 Edition
    • Brief History Of Windows 7
    • How To Transfer Files From Windows XP to Windows 7
    • Laptop Screen Black On Startup – Everything Else Working
    • Prevent Programs Running At Start-Up Script
    • How To Clean Temporary Internet Files With A Log Off Script
    • Disable MSN Messenger From Always Running At Start-Up

Privacy Policy | Smart Energy Meters | Trackit Software | Help Desk Software | Articles | About | Sitemap