I’m going to show you two easy ways to automate tasks in Windows, but first let’s establish some specifics about what we want to do.
The easiest way to clean temporary folders is to use Windows built in Disk Cleanup Tool which can be started either from All Programs > Accessories > System Tools on the Start Menu or from the command line using cleanmgr. By default this program has a GUI Interface meaning that it displays prompts that require user input in order to run, so before we can automate it we need to create saved settings for it to use so that we don’t have to do it manually. This is useful if your schedule your automated task to run when you are not at your computer. Microsoft has already considered this scenario and built the Disk Cleanup Tool with this option.
Saving Disk Cleanup Tool Settings for future use
Now whenever you want to run Disk Cleanup Tools with these settings you can use the command line cleanmgr /sagerun:11.
Option 1: Automating Windows XP using Scheduled Tasks
Windows Task Scheduling is a built in feature that allows a user to run specific tasks including programs, scripts, and documents at specific times or intervals. So let’s create an automated task.
For more information on creating Scheduled Tasks check out this Microsoft Knowledgebase article
For information about editing created tasks check out this article
Option 2 : Automating Tasks at Windows Startup
The second way to automate a task is to create a shortcut in the StartUp folder which executes everytime windows loads. The Startup folder is located on the Start Menu under All Programs.
Alternately you could navigate to the StartUp folder in My Computer or Explorer and create the shortcut there directly by right-clicking and choosing New… > Shortcut. The system wide StartUp folder is located in the Windows Directory usually C:\Windows\StartUp or C:\WINNT\StartUp. The user specific location is under C:\Documents and Settings\username in XP or C:\Users\username in Vista.
These ways can be used to automate virtually any task on your PC as long as you know the programs location or a specific command line. Hope this helps.