One way to automate tasks is to use the Task Scheduler, and of course batch files to do the task...
Tired of emptying the temp folder? Or forgetting to empty the temp folder?
Would you like to make a process to automatically empty that folder on startup or shut down?
Batch files are great tools for doing repetitive tasks or jobs that need to be done frequently or that are time consuming.
Emptying the temp folder is one of those tedious, time consuming, repetitive tasks that needs to be done
or your hard drive will run out of storage space, you need to automate tasks.
One day I received a call from Customer Support Level One, the tech had a problem with a customer's hard drive, it had less than 10% space open but he couldn't find what was filling it up. So he turned the problem over to me (3rd Level Support).
I went to the customer and asked to use her computer, I explained I was there to find out what was filling up the hard drive.
It took me about a minute to find the c:\documents and settings\her user id\local settings\temp and temporary internet files had literally millions of files in them.
You see someone had turned off the clear cache on the IE browser and loaded Fire Fox browser also and this had the cache set to not clear either.
The only way I could empty those two folders was to start the Operating System in Safe Mode and delete the folders then recreate them. Deleting individual files was not an option, to many files.
So you ask what is a batch file? In reality it is a list of commands that are in a file.
Back in the early main frame days commands were issued to the main frame computers on a punch card. One command on a card. When the operator had enough cards (from a couple hundred to thousands) the operator would run the commands. It was called a batch of commands. Thus putting all the commands in a file became a batch file.
How do you create a batch file?
Well it really isn't complicated but there are rules, these rules are called syntax. To read up on the batch file creation process
see this page to
Once you are up to speed on writing batch files your next task is to figure out where all those pesky temp files are hiding. That is
if you haven't used this page to
optimize your computer and used the temp file location suggestion.
Troubleshoot, repair, maintain, upgrade & secure...
Next write the batch file to delete the temp files when you either start your computer (suggested) or when you go to shut it down. I suggest you do it on startup because as soon as you open your browser parts of the temp folder/directory will be locked with open files and the batch file will fail to clean all the files out of the directory.
Here is a sample batch file I made to automate tasks for cleaning my temp directory:
table, or PDF was removed because it will not display on your device. Check back on a PC....
Note: You can
not copy this text from this page it is an image...
One problem with a batch file is you have to specify each folder/directory or it will only delete files in the named directory and not delete any directories under it. That is the command can not delete nested directories that have files in them you have to go in to each directory and delete the files then the
This is a problem with Microsoft software, IE creates temporary directories and files that use a random naming convention. Such as 9P123X or XTXYU for folders/directories and files.
If you use IE only and want to keep your temp folder/directory clean you have to set the size of cache and set the check box to 'Clear History on shutdown'. This will clean only the IE files from the temp folder it will not clean other program files from the temp folder, thus use the batch file above to finish the job.
If you keep the temp folder clean then when you run your defrag the program will have less to do and will finish a little faster.
There are other things you can do with a batch file
to automate tasks like start a program after startup with a delay or start a service at a certain time, or shut down the computer at a certain time unattended.
Can you imagine how many files it would take to fill up a 1TB drive?
Have you emptied your temp directory?