Need a script that will delete a users Internet temp folder on Windows 2000 and XP

Posted on 2004-10-26
Last Modified: 2012-05-05
I have been noticing more often that viruses are being found in the Internet temp folder located at c:\documents and settings\%username%\local settings\temporay internet files.  I would like to have a script that can be executed either by scheduled events or by logon/logoff that deletes all of the files located in that folder.  Can someone give me a complete script solution to do this?  
Question by:murryc
    LVL 2

    Expert Comment


    Have you tried Disk Cleanup?  You can add that as a scheduled task to run every day if you need it that way.  It would be more easier than having to write a script of some sort.

    Hope that helps!


    Author Comment

    dev8..can you run that task with switches so that it does not prompt the user for anything?  I am looking for a fast, simple, transparent solution that the user does not even know is working in the background.
    LVL 6

    Expert Comment

    Microsoft has DelProf.exe.  It Is WAY cool, and you can run it remotely:
    LVL 2

    Expert Comment

    LVL 2

    Accepted Solution

    Me again,

    To setup up:

    go to run,

    type in cmd

    then type cleanupmgr.exe \sageset:1

    From here you will select what you want to cleanup.

    Then add a scheduled task

    add disk cleanup as a scheduled task and add it to run whenever you want

    Before it finishes, click the option to select advanced settings

    You should see a "run" line like so:


    simply add /sagerun:1 at the end:

    C:\WINDOWS\system32\cleanmgr.exe /sagerun:1

    This will automatically run diskcleanup for you in the background without user interaction!

    Just refer to the article i provided earlier!


    LVL 20

    Expert Comment

    PAQ on the subject here - worth a look courtesy of Pete Long et al,

    Solution Title: Batch file to delete temporary internet files and others

    Deb :))
    LVL 95

    Expert Comment

    by:Lee W, MVP
    Why not just configure outlook to Empty Temporary Internet Files when browser is closed? - Internet Control panel, near the end of the options listed under "Advanced" tab  

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Anonabox PRO Tor & VPN Router

    PRO is the most advanced way to fortify your privacy and online anonymity by layering the Tor network with VPN services. Use both together or separately, and without needing to download software onto your devices.

    NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
    Before you start a podcast of your own, you’ll need to get the right equipment. To help you get started off on the right foot, here’s a list of the four critical items you’ll need to start your own podcast.
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    933 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now