DOS Batch in Plain English
Home News & Articles Tutorials Downloads About this site

Introduction

What are batch files?

Goto Start>Find>Files and Folders.  Search for *.bat in My Computer.  These are batch files.  These are your friends.

-What are they good for anyway?

Notice Autoexec.bat in your previous search.  Every time you start up a dos based OS, (ie: Windows 95/98/2000) this file will load.  Sometimes it is useful to be able to edit this file.  You might find that batch skills improve your DOS skills.  Is batch file talent necessary?  Probably not.  But every windows system has a command prompt.  If you have a command prompt then you can do batch.

Some programming languages require special software (ie: C, Perl, BASIC) that have to interpret your text.  In batch, your interpreter is command.com.  Command.com is a command-line-interpreter.  This means that your batch files don't need to be compiled and packaged into neat applications.  They just sit there in plain text until command.com runs through them line by line like some masochistic bookroom in the library of congress.

-What can you do with them?

I once saw downloaded a claimed "Batch file RPG game".  I never got it to work.  I can't imagine the amount of time and resourcefulness it would take to complete such a project.  Complex programs are hard to make in DOS batch.  You don't want to make applications with them, just dirty little scripts.

For example, I have a computer in one room and another computer with a modem in the other.  I use the computer with modem as a proxy server for internet access over my home network.  Sometimes my proxy server gets turned off without me knowing it by other members of the household.  I wrote a simple batch file that would test to see if the proxy server computer is on or not.  If the proxy is on, then I automatically launch Internet Explorer and the proxy dials my ISP on my slow, slow 14.4k modem.  The batch file can also tell if the computer has just turned on and will wait 40 seconds for the proxy to boot to windows before automatically launching Internet Explorer.  This will all be explained in the later part of this tutorial.

 

next

Page 1

Page 1 - Introduction

Page 2 - The beginning

Page 3 - Variables, Loops and What-ifs

Page 4 - Pipes, Redirection and Switches

Page 5 - Where to go with batch

hide

Scripts are very linear routines that are usually found in networking environments.  They are built for custom needs and situations.  Scripts make life more efficient so that you can play at least an extra hour of Quake III every day.