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

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?  
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


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!

murrycAuthor Commented:
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.
Microsoft has DelProf.exe.  It Is WAY cool, and you can run it remotely:
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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!



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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 :))
Lee W, MVPTechnology and Business Process AdvisorCommented:
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  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 2000

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.