Social Icons

Friday 6 July 2012

Delete Temp files at System Shutdown ?

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.



disk cleanup settings

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.

No comments:

Post a Comment