This page is no longer maintained: I no longer have access to real DOS or Win9x.

The information here is obsolete - don't even try to apply it to Win9x or NT series batch files.

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.

ZIP archives of this material (not always completely up to date, but refreshed after major additions) can be had as /batch/batchbk.zip, by annonymous ftp from gearbox.maem.mst.edu as BATCHBK.ZIP in the /pub/batch directory. These archives are DOS compatible (short file names) but since some of the internal links are to the origianl long file names, not all of the links will work. Long file name versions are available in the same places using /batch/longnames.batchbk.zip or the file name longnames.batchbk.zip in the FTP directory

Absolute beginners probably should start with Definitions