Windows does not automatically delete temporary files during system shutdown. This means that deleted files in the trashbin and temporary files like those in the Internet Cache are still accessible after a restart of the system. System cleaners like CCleaner or Disk Cleaner are able to delete those files but I would like to show a way how many of them can be deleted by using a Windows system tool.
We are going to configure the Disk Cleanup Settings in Windows to delete the temporary files and create a new rule that the software will be run during system shutdown.
Our first step would be to open the Disk Cleanup Settings and configure them the way we want. To do that you use the Run command in Windows XP / 2000 or the search in Windows Vista.
cleanmgr /sageset 1
This opens the Disk Cleanup Settings. Check the elements that you want to automatically delete. If you are unsure about an element click on it and read the description. This should give you a good understanding of it.

Open the Group Policy Editor now. You do that in the same location where you started the Disk Cleanup Settings.
gpedit.msc
Navigate to User Configuration > Windows Settings > Scripts (Logon / Logoff) and double-click on Logoff.

Click on Add and Browse in the next window. Right-click in the blank space of the Logoff folder and create a new text document. Name it cleanup.cmd. Open it with a right-click and add the following line to it.
cleanmgr /sagerun 1
Select the file cleanup.cmd and click Open and in the previous menu OK. The file that you created should be now in the list. Click on Apply and OK afterwards. Et Voila, we are done.
Everything that you selected during the configuration will now be deleted after every system shutdown.
Read Related Posts
5 Responses to “Clear Temporary Files during System Shutdown”
Trackbacks/Pingbacks
-
[...] 原文链接。 I hope you enjoyed reading this post. You may now subscribe to my RSS Feed, scroll down to 留下评论 or get back to the homepage. I recommend Giganews, the ultimate P2P alternative: Read here why [...]
-
[...] gHacks radau patarimÄ…, kaip padaryti, kad laikini failai bÅ«tų iÅ¡valomi kiekvienÄ… kartÄ… iÅ¡jungiant kompiuterį. KonfigÅ«ravimas nÄ—ra sudÄ—tingas, bet kiekvienÄ… apraÅ¡ytÄ… žingsnį reikia atlikti atidžiai. Turiu perspÄ—ti, kad dÄ—l valymo operacijos kompiuterio iÅ¡jungimas trunka ilgiau. Stacionariems kompiuteriams tai geras iÅ¡sivalymo nuo Å¡lamÅ¡to metodas, bet neÅ¡iojamiesiems nepatarÄ?iau – juos kartais tenka iÅ¡jungti paskubomis ar besibaigiant elemento įkrovimui, kai intensyvus disko darbas nepageidajamas. [...]

Clear Temp Files on Windows Mobile Pocket PCs
Superfast Shutdown for XP and Vista
Shutdown, Restart Or Logoff PCs With Twitter
The Ultimate Windows Shutdown Application
Reduce Windows XP Shutdown Time
PC Shutdown Manager
Automatic Shutdown
Analyzing Windows Shutdown Performance
I’d tried a very similar method a while ago – though that one used a batch file with the following contents:
RD /S /Q %TEMP%However, that didn’t really work perfectly (there were always a few files and folders left after a reboot), so I will give this a try now.
This thing makes shutdown take forever. Stick with the a batch file.
Thanks for procedure to delete tmp files at shudown, it was great.
Best wishes for New Year
Harry