




		 INTRODUCTION   
     

     
     This book was written to introduce the new user to MS-Dos
batch files and how to create and use them.  You will find this
book easy to read and understand.  It was written for the new
user but all computer operators will can find it to be a good
useful book to have in their collection. 
     You do not have to be an expert on computers, or a
programmer to create batch files to make your computer do what
you want it to do.  The computer will only do what you tell it to
do. If you want to use less key strokes and speed up access to
MS-Dos programs you can with batch files.  Do you want a menu on
the screen showing all of your MS-Dos programs,  and starting a
program with just two key strokes?  If you do then this is the
book for you.
     I have included sample batch files that can be used to open
programs,  put menu's on the screen,  change the color of the
screen from black and white to any color you want. Its all in
this book.
      This book is a good starting point for writing batch files, 
and a very good reference source.  If you want to go into more
advanced batch files I advise you to try the books I have listed
at the end of this book.  Who knows, you may decide to go to
school for programming. 
     Read the entire book before attempting to write a batch
file!        



                       BATCH FILES                  

 
                    WHY DO YOU NEED THEM?
 
               WHAT BATCH FILES CAN DO FOR YOU?


WHAT IS A BATCH FILE:

     Let me start off by giving a short and easy explanation of
what a batch file is and what it does:  A batch file is a DOS
tool that allows you to automatically execute one or more DOS
commands.  It is a file that contains commands that change
directories and run programs with only a few key strokes.  For
example:  You are at the  C:\ prompt and you want to enter your
database program and do some work.  To do this you would have to
change to the database directory which may look like this:
C:\database. 
     Now that you're there you have to type something to start
the program. Than wait for the program to start.  With a batch
file all you would have to do is type DB (for database) and your
database programs is on the screen.  Doesn't that sound easy?
Maybe too easy to be true.  Maybe you think this batch file is
hard get or to write. It can be very easy and cost you nothing
     If you had this database program in MS-DOS Windows you
wouldn't have to do all of that.  But, everyone doesn't have
Microsoft Windows yet,  and some of us have some programs that
will not run in the windows environment.  Batch files make
opening these Dos based programs easy. 
     When I bought my computer it had only 1meg of ram and had no
programs in it.  I was in training to repair and build computers
so this was a good start. I ended up buying a lot of games and
programs that worked in MS-DOS. Then when I got a 210meg hard
drive and 4megs of ram I went out and got myself the Windows
program.  Of course all of the programs I had did not run very
well in the windows environment.
     I liked some of these programs and didn't have the funds to
replace them. So to make it easier for me to run these programs
and Windows I started writing batch files to quickly open these
programs. I now have window programs running in windows and I
have Dos based programs that I run from the Dos C:\prompt. I
allow my children to play the Dos based games in my computer and
not have fears of them getting into the Windows program.
     After my computer completes its bootup process I end up with
a menu on the screen.  This menu shows some of the programs on my
hard drive including the Windows program.  This menu also shows
what letters to type to start the program.  I don't know about
you,  but I cannot remember all the letters and words to start
all of my programs.  This is why I have a batch file put a menu
on the screen.
     In the Windows program there are pictures with the names of
the programs under them.  All I have to do is move my mouse
pointer to the this picture which is called an Icon and click the
mouse twice and the program starts. This is easy,  but if the
program is not in windows you can use a batch file to start the 
program at the c:\prompt.
     When I exit a dos based program the computer puts the menu
back on the screen.  I can either turn the computer off or start
another program.  I start at the menu and return to the menu with
out typing anything. A batch file does this for me,  and it could
do this for you.
     In case you didn't know it you have a batch file in the
computer called the autoexec.bat file.  It is the batch file used
by the computer during boot up. It tells the computer what to do.

BATCH FILES: Saves time and keystrokes.
             Simplify using Dos and decrease errors.
             Will automatically run commands.
             Speeds up access to a program

 
	****** MS-DOS COMMANDS ********

There are some Dos commands that you need to know how to use
before you start writing batch files.

CD = CHANGE DIRECTORIES

Type = THIS WILL PUT TEXT ON THE SCREEN                     

EDITOR = A Dos program that writes in ASCII

CLS = clear the screen

MD = Make Directory 
Dir = Directory
Print/prn = sends text to the printer

Copy = copy comand-copy files 

* Read your MS-DOS manual that came with your computer, and get a
  good understanding how to use these commands. 

COMMANDS USED FOR BATCH FILES (MS-DOS 5 to 6.22):
Copy Con = The short method to create a batch file
           example: To create a batch files with name of menu.bat
                    At the prompt type: c:\copy con menu.bat
                    (must have a space between copy and con)

Edit = Text Editor in Dos 5 and later versions. Used to make long 
       batch files.
CLS =  Clears the screen of all text
Echo = Suppresses or enables the display names on a batch file.   
        You will not see the commands in a batch file on the      
        screen while the batch file is executing commands.
       example: Echo off
                Echo on
@ =  Used in MS-DOS 3.3 and later. With @ you do not need to use  
     CLS under echo off. It will suppress the command name        
     displayed. Dos versions earlier than 3.3 must use cls        
     under echo off.  Example: @echo off
    For Dos versions before 3.3 example: echo off
                                          cls

$p = directs Dos to display the current drive directory 
      example: c:\
$g = greater than symbol (>). Is the prompt.
      example: c:\>
$T = will display the current system time
$D = Will display the current system date (military time)
$_ = Will move to curser to next line
$ = You can type a state ment after $
F6 = Saves a copy con file to disk (same as Ctrl & Z)
CTRL+C = Will stop execution of a batch file command
REM = Allows you to make remarks or comments in a batch file that 
      no one else can see. You can make statements that explains
      what the batch file does.
Pause = When you insert this command the batch file pauses and    
      displays a message that you wrote such as: Press any key    
     to continue
Bat = Short for batch
Batch File Commands (MS-DOS and earlier): 
EDLIN = Line editor. It allows you to create and change files
  *  =  Is the prompt used with edlin. Each line in the file will 
       have a * (asterisk) and a number for that line and a       
       space.  Example: 1:* then write your line
NEW FILE = must be the first line when witting a new file
  I  = The Edlin insert command
CTRL + c = Tells Edlin you're finished writing
  E  =  Saves the file. Must press enter to get the prompt
  1  =  numeral use to edit line one in the file
(For more information on using Edlin refer to your MS-DOS manual)

