Automate Tasks


Home     Sitemap

We seemed to have lost an art, writing batch files to do things for us...

What are they and what can they do to make some of your everyday tasks easier?

Batch files have been around for a long time, actually a Main Frame term from the early 1960's.

So what are they and what can it do for you?

They are simply a file that is executable with a list of commands to do a single task, a couple of tasks, or even a long list of tasks.

You can run it from the command prompt or if you are using DOS the command line.

Do mundane, repetitive, and scheduled tasks every time with out taking time away from other tasks.

Write a document to run automatically to do your backup and then schedule it to run when you feel it needs to be done.

"Define, design, then assign".

Using it will lessen your work load and take the worry out of a task that has to be done but you dread doing it.

Some examples of a batch file -

If you start a Command Prompt while in Windows you will use a batch file called Autoexec.nt - note the .bat is a dos term that stands for batch, like .com stand for command, .sys stands for system and so on.

If you do a search on your computer you for Autoexec.bat you will not find it unless you happened to copy it from a DOS environment.

On a Windows NT and forward Operating Systems it is called Autoexec.nt. This is to keep the file from being executed by mistake.

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

The 5 Steps to high quality and cheap
DIY Computer Repairs

Get It Today...

It can only be called (or executed) by the Command Prompt. Although you can run Autoexec.bat in the Command Prompt it is not a good idea because the file can set environment variables that could cause your computer to hang or even crash.

This is what a couple of them look like:

Autoexec.bat -

@echo off



@echo off

REM AUTOEXEC.BAT is not used to initialize the MS-DOS environment.
REM AUTOEXEC.NT is used to initialize the MS-DOS environment unless a
REM different startup file is specified in an application's PIF.

REM Install CD ROM extensions
lh %SystemRoot%\system32\mscdexnt.exe

REM Install network redirector (load before dosx.exe)
lh %SystemRoot%\system32\redir

REM Install DPMI support
lh %SystemRoot%\system32\dosx

As you can see there are a lot of abbreviations in the file, each one is shortened because the original DOS environment was very limited in memory capacity - it was 640 KB maximum in size, most text files now days are bigger than that!

A short list of explanation for the abbreviations in the sample above:

@echo off - turns off the repeat of the command when it is executed by the file.

REM - Remark - non executable text

lh - load high - load the program in to high memory before executing the command.

PIF - Program Information File - this file has parameters and configuration information for the Windows Operating System.

There are a lot more of these abbreviations.

It will do a lot of things for you once you have studied the syntax (format) of the command.

You can have one run your backup every day at a certain time.

Or you could have a batch file open different programs at a given time of day, say you have a meeting every Tuesday at 10:00 AM. for the meeting you will need Power Point, Excel, Word, and your Netmeeting.

Instead trying to remember the time and to open the programs you could write a file then schedule it to run every Tuesday at 10:00 AM. Then the next Tuesday at 10:00 AM your programs will open automatically. A boon for us forgetful types.

When your virus scan runs every day at 9:00 AM it is done by a type of batch file, not the command prompt type but a schedule that has the program name, location, and time of execution.

So how would you setup the file?

Well lets have a look at a file that will open four programs -


path=C:\Program Files\Microsoft Office\Office10\


path=C:\Program Files\NetMeeting\start conf.exe

Note: Netmeeting has to be setup before it will work as in this example, you can set it up by typing netmeeting in the run box from the start button.

Now you have your file, note that I named it .cmd, this is the same as .bat, it is a change that Microsoft introduced with Windows NT because the first version of the Operating System did not have .bat file extension in the code.

So the next step would be to test the file by running it from the command prompt or the run box with the start button.

How did you do? Messed it up? Well if you copied the lines of commands from this web page and put it in a word document you copied all the code in the web page that makes if pretty - the formatting code. Try it again and paste it in to Notepad.exe then save it with a name and the .cmd extension, put it on your desktop so you can find it easily.

Now what happened? All four of the programs started?

If your file worked your next step would be to schedule the start time to execute the file. You could use the 'AT' command in the batch file but it is easier to run the Windows Task Scheduler from the Control Panel.

The Task Scheduler is fairly easy to configure the only thing you will have to remember is where you placed your file after you tested it.

There are a lot of things you can use a batch file for running a set of programs at a given time is just one.

You could use it to open all the programs you use everyday at startup instead of clicking on them one at a time, just make your file then place it in the startup folder in your profile under the Documents and Settings folder, or you could schedule it...

In one of my e-courses I setup a way to delay the start of services, using a batch file you could have your everyday programs open one at a time on a schedule. The only draw back to using the schedule is that if you are late in starting your computer the scheduled task time will have passed and the program will not run, in that case you would have to open it manually.

Here is a sample batch files I made to clean my temp directory:

Rem - This is a batch file to delete all the files from the temporary directory
Rem - Monte Russell 09/03/09
Rem - You are free to modify this file and distribute to all your friends!
Rem -
@echo off
Rem select your drive
del /Q *.*
Rem this file will not delete files inside a folder if you want to add a folder this is how you do it
CD FrontPageTempDir
del /Q *.*

Automation is great...

Update 02/09/20 After using Win 10 for some time I have found that using a batch file with this OS is sporadic, that is sometimes it will work as advertised, sometimes it will fail, one of the failures comes when you try to put the file in the "Startup" folder, it will not run. I have done some research on why not and will do a article on this at a later date, or if you are stymied at this time do a search on "Windows 10 startup folder".


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 Batch Files

Use batch files for automation of your work

Home    About    Sitemap
Fix It Blog!

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