It is really easy to set Windows XP to delete the contents of your Temp folder (or run any other commands) on shutdown. There are numerous reasons why you might want to delete your Temporary files when you shutdown Windows XP. Your Temporary files folder can get extremely large. Take a look at what is in C:\WINDOWS\Temp.
The first step is to install Xecutor. You can download Xecutor from the Xpertdesign homepage.
The second step is to create a batch file that will delete your temporary files on shutdown. To do this open up notepad and type the following line:
del /Q G:\WINDOWS\Temp save your file as tempdelete.bat. Alternatively, you can download my tempdelete.bat file if you prefer.
The third step is to configure Xecutor to run the tempdelete.bat file on shutdown. Open Xecutor, and answer no to the stream of questions
it prompts you with the first time you run it. Next choose the shutdown tab and add tempdelete.bat file. This is shown below:
After you hit OK you will now see tempdelete.bat in the shutdown tab of Xecutor.
Now just close Xecutor and it will run in your system tray. The last step is to drag the Xecutor icon from your desktop into your Startup folder located in Start >> All Programs >> Startup so that Xecutor starts when you start Windows.
You are all set, now when you shutdown Windows, your temporary files will be deleted, as well. You can add other commands the same way (i.e., delete cookies, delete My Documents, etc.).
What other commands do you think would be useful to run at Shutdown? Let us know in the comments.
You can follow us on Twitter or join our Facebook Fan Page for more updates like this.
Related posts
- Start with a thorough XP system checkup
- Vista SP2 DirectX 11 Upgrade
- Two Ways To Upgrade From Windows XP To Windows 7
- XP SP2 XPiration
- Free Windows XP and Windows Vista
- XP SP3 Will Outlive XP SP2 by 4 Years
- The Apex of Security for Microsoft
- Windows 7 RTM XP Mode Duplication Tool
- Cloud Optimization for Windows 7, Vista and XP
- Patches Coming for 25 Vulnerabilities

thanks i’ve been look for this trick for quite sometime now.
Interesting info, but a bit dated. It is true that there is a %windir%\temp directory and it is used but the big directoy to be deleted is the %userprofile%\local settings\temp and %userprofile%\local settings\temporary internet files\. These directories get filled up very fast. There also is the history files also under the same tree and a userdata directory that has several nonsensical directories that can be deleted. Create a batch file for any you want to delete and make sure you use the del /s /f /q to not only delete without prompting, but also grab any subdirectories and force the deletion of any read only files. Remember, this is a temporary directory so there should be nothing in there that needs to be kept after a reboot. I would also redirect the output to a log directory so you can make sure files are being deleted. Use the >> logfile.txt at the end of the batch file command string and replace logfile.txt with whatever you want to call your log.
But the main thing is, why download another third part tool to execute the batch file? Simply do this: Start > Run > gpedit.msc. Look under Windows Settings > Scripts (Startup/Shutdown). Double click on Shutdown and browse for your batch file(s). Every time you (gracefully) shutdown Windows, all scripts will be executed via Group Policy. Group Policy is very powerful and useful in managing Windows.
what is you dont have gpedit?