• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1066
  • Last Modified:

Delete temporary files/folders automatically in vista and xp

There are too many posts on this subject and many of them give obsolete ideas. Hence I am posting this again as I dn't have time to go through all the posts.

How can I dete the temp folders/files during shutdown or restart in Windows Vista and XP?

2 Solutions
Great quick instruction set on doing just that during a shutdown:

I can't really improve on that answer, but I can offer this additional tidbit:  If you have a machine with multiple user profiles (such as a terminal server) you can clean them all at once with a handy utility called ICSWEEP (about a third of the way down the page).  It's freeware, and it's command line; thus easily scripted.

RETAILREALMAuthor Commented:
Hi Flubsster,
The solution has worked on my Vista Business machine but it is not working on XP SP2  machine. I dont' mind giving the points to you. But do you have any suggestions to make about XP machines?
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

What command are you using to setup the cleanup options?

It isnt hanging at "Compress old files" is it?
RETAILREALMAuthor Commented:
Hi johnb6767,
It takes 20 minuts to shut down. It does not matter if the compressed files is checked or not.
The temp folder on C dive is not emptied. It has got lot of PREFETCH files and lot of other files with the extension .TMP.
We manually added some fils with extension "TMP". But these are not getting deleted even if we shift the system date by a year ahead and then repeated the procecure. we are using a batch file as pointed by flubbster above which has the follwing code

cleanmgr /sageset 1
That sets the options, and then the actual command to run the cleanup is going to be ......

To set options

cleanmgr /sagerun:x  (where x is the set of rules)

To run the cleanup....

cleanmgr /sagerun:x
RETAILREALMAuthor Commented:
Hi johnb6767,

we have tried cleanmgr /sageset 1.

This is not emptying the temp folder. You have mentioned that 'x' is the set of rules.
Can you provide and example of what the rules are?

cleanmgr /sageset:1
Disk Clean up pops up, and then you select your options......

That becomes configuration 1.

If you want to run Configuration 1, you will enter.....

cleanmgr /sagerun:1

You can have multiple configurations, just do the next one with /sageset:2, /sageset:3 etc... Then use the /sagerun:2, /sagerun:3 etc....
RETAILREALMAuthor Commented:
All temp files are still not getting cleared. But I guess the method of automating the clean up has been explained properly. Hence I am accepting the solutions and closing the issue.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now