DOS Batch Language: A personal view

A Web Book in Progress

This is a collection of essays, notes, etc. - all of them work in progress. The subject matter is DOS batch files, their uses, their gotchas, "how to do it", and a few impossibilities. Input and feedback from readers are welcome. NOTE: the subject of the message must contain the word "batch" for the message to get past the spam filter. Almost all the material here is original in the sense that I'm not copying anything from anybody, but the ideas have many sources. Some are mine. Some of those duplicate those of others. Some came from elsewhere and have been reworked to fit my style(s).

One of the important differences between a book published on paper and one published on the Web is that here the reader can make contributions to the never completed work. A book on the Web need never be "finished" (whatever that means) - it can be useful while it is being written and corrections, expansions, enhancements, and even major rewrites can all be incorporated on the fly.

Remember while you are reading these pages that you are looking at a work in progress, and you can contribute to it.

This is an exploration and illustration of the workings of COMMAND.COM and some utilities supplied with MSDOS 6.22. Much of the example code works without modification under other recent versions of DOS and with other command processors, but none has been tested except under the the conditions given. The restriction of testing to COMMAND.COM is explicit where secondary command processors are used: they are spawned with COMMAND, rather than the generic %comspec% syntax. In the real world the generic syntax is usually referred.

Since I am more interested here in the behavior of COMMAND.COM than in effiency some of the example code is intentionally far from optimum - some of it even reaches out to the limits of the possible (and beyond what was thought possible) and well beyond the reasonable. There is no intent to provide working batch files for everyday use, though some examples are suitable for that sort of use - rather the intent is to teach and to learn.

Unless otherwise noted, everything here is Copyright 1995,1996 by Ted Davis - all rights reserved. The reader is granted a limited license to use the code for educational and experimental purposes, but no one is granted any right to use or reproduce this text or code for commercial purposes of any nature. If you want to learn from it, go right ahead; if you want to earn from it, then I get a cut - it's that simple.

Absolute beginners probably should start with Definitions

Dirk van Deun's Batch MiniFAQ has references to most of what's on the Net. There was also quite a bit of material at http://www.uxbinfo.com/412/index.htm, including a list/discussion of undocumented MSDOS command features (1995, so it's somewhat out of date) in MUF17.ZIP - this went away and I was able to find a new link only for MUF17.ZIP.

alt.msdos.batch is an excellent supplement to the on-line tutorial material - it can be used as the "end of chapter" questions for the student to work out on his own, with answers provided. Read the questions, but not the answers; work out your answer(s); then, and only then, compare your answer with the ones provided by the experts. Be sure to verify the answers supplied - not everybody who posts there gets it right, and even the experts have bad days. You will soon learn which people provide the most reliable answers (several have on-line material linked to from the Batch MiniFAQ (above)).


  ** Copyright 1995,1996, Ted Davis - all rights reserved ** 

Back to my personal links page - back to my home page