Batch Files?


Home     Sitemap logo

How do you Automate Tasks? With Batch files of course.

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 automate tasks.

You need this in your IT Tool Box! Get yours today...

Troubleshoot, repair, maintain, upgrade & secure...

    With this!

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.

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:

The image, table, or PDF was removed because it will not display on your device. Check back on a PC....

Do to the chance that this text is on another web site I made it in to an image, sorry for the bother...

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 directory.

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? Gazillions!

Have you emptied your temp directory?

Emergency Repair
isk (ERD) - Will Yours Work?

Repair Disk

Custom made for you...

You keyboard isn't thirsty, and it doesn't need calcium. Milk and other liquids will ruin a keyaboard!

This Web
Site is a
labor of Love
But Love
doesn't pay
the bills!

Please chip in $5 to keep it live...

Need A Checklist?

Need A Repair Manual?

    Page copy protected against web site content infringement by Copyscape

You can:

Return to
previous page:





Thank you for visiting my web site, and please come back again.

This website is not intended for children under the age of 18

Author of this web site: Monte Russell

FTC Endorsement Rules
All testimonials on the DIY Computer Repair web site are from customers who were not paid to comment on any products!

The Flag of The United States of America!   Proudly Made in The U. S. A.

Copyright and Registered to, all thieves will be prosecuted to the fullest extent of international law!

From the Desert South West ~ Arizona, U. S. A.
Copyright DIY-Computer-Repair.Com 2006-2016


"You found this web site through:"

Active Search Results

Return to top of Automate Tasks

Use batch files to automate tasks

Home    About    Sitemap
Fix It Blog!

From the Desert South West ~ Arizona, USA
Copyright 2006-2015