Contents of the BATLITE.DOC file
Released: 12 March, 1992
Author: Pieter A. Hintjens
Address: Oedenkovenstraat 38,
Telephone: (323) 271.0509 [voice/data/fax]
Copyright: (C) 1991-92 Pieter A. Hintjens. All
rights retained by the author.
Distribution: Free. May not be sold. May be bundled
with other products or services without
restriction so long as this documentation
accompanies the program BatLite, and
neither is modified.
Disclaimer: This product is delivered without
guarantee of any kind. The contents of
this document are for information purposes
only. While the author has taken great
care to ensure that this software is
reliable and useful, liability for use of
this program rests entirely with the user.
The author reserves the right to change
any information in this document without
Registration: Optional. If you find BatLite convenient
and useful, you can register by sending
$25 (BEF 750, UK 12.50) to the above
address. Please state which version of
BatLite you are using. When you register,
you'll be placed on my mailing list, and
get the next version of BatLite when
BatLite compiles a .BAT file into a .COM file. The .COM file
loads and runs quickly, and has other advantages over a normal
- repetitive texts are compressed. For big batch files
the savings can reach 50% or more.
- BatLite compiles GOTOs into direct jumps. This is
quite a bit faster than DOS's method of searching the
batch file line by line starting at the beginning.
- the compiled batch file is tamper-proof. It resists
casual examination and cannot be changed without the
- the compiled batch file runs entirely from memory.
This allows you to create an install batch file which
loads from the first of several installation diskettes,
then continues to run after the first diskette is
removed. Impossible with a normal DOS batch file.
BatLite is free. You can use it privately, in business, on a
network, or include it in your products. If BatLite gives you
a competitive edge, so much the better. However, you must
supply this documentation, unchanged, with any copy of BatLite
that you distribute. If you want regular updates and telephone
support, register as described above.
Place BatLite.EXE in the current directory or in some other
directory which is on your path. To run BatLite, just give the
Or, you can BatLite several files at once:
You do not need to supply the .BAT extension. Each .BAT file
is converted into a .COM file with the same name. Thus, a
batch file `INSTALL.BAT' becomes `INSTALL.COM'. The .BAT file
is not modified in any way. To run the .COM file, simply type
its name at the DOS command prompt. If a file exists in both
.BAT and .COM forms, MS-DOS will always run the .COM file.
For a quick summary of BatLite options, type:
BatLite supports all MS-DOS commands from versions 2.11
upwards, with some minor exceptions (see later). The DOS
redirection and pipe commands (<, >, and |) work as they do in
a normal batch file.
By default, a compiled batch file will halt after executing
another batch file. This behaviour is identical to the
behaviour of a normal DOS batch file. If you use the CALL
command, BatLite continues, like DOS versions 3.3 and up. You
can ask BatLite to continue in any case by running it with the
`/Nobatch' switch. If you use this switch, a compiled batch
file will continue after executing another batch file.
You can interrupt the execution of a compiled batch file by
pressing Ctrl-C. This displays `^C' and ends the execution of
the compiled batch file. To avoid problems with MS-DOS, Ctrl-C
is not handled at once, but when the current command is
finished. If you do not want this possibility, run BatLite
with the `/NoCtrlC' switch. If you use this switch, the person
who runs the compiled batch file will not be able to break out
You can abbreviate any switch to a minimum unique name.
Example: BatLite/nob/noc *.bat
1. BatLite can cope with all MS-DOS commands except the
command `FOR....DO GOTO...'. This is because the FOR
command is so complex that BatLite passes it directly
to MS-DOS to execute. Since GOTO's are compiled into
fast jumps which MS-DOS knows nothing about, the GOTO
in a FOR command will have no effect.
2. The replaceable parameter %0 is ignored. The
parameters %1 to %9 work as usual, also in GOTO
3. BatLite will compile and run batch files of up to 48k
4. A compiled batch file requires some memory to run,
whereas a normal batch file does not. This means that
very large programs may not run from within a compiled
batch file while they do run from a normal batch file.
The smallest compiled batch file will use about 2.5
Kbytes of memory when running.
5. BatLite does not work with the 4DOS command shell, ver.
3.01 or lower. This is due to an area where 4DOS does
not behave like COMMAND.COM. The authors, J. P.
Software, plan to implement the necessary support; this
may already be working in the latest releases of 4DOS.
6. BatLite has been tested with MS-DOS versions 2.11,
3.20, 3.30, 4.01, and 5.00. It has not been tested,
but should work with any other DOS version, including
DR-DOS versions. See below for limitations with
untested DOS versions.
7. If you have a TSR which takes over interrupt vector
2Eh, you cannot access environment variables which are
SET in the same batch file.
8. A compiled batch file requires some help from DOS.
Don't try to run a batch file which uses DOS 5.00
commands under DOS 2.11. It won't work.
Under DOS versions _other_than_ MS-DOS 2.11, 3.20, 3.30,
4.01, or 5.00, a compiled batch file is not re-entrant. This
means that if you start one compiled batch file, and from
within that one you start another (even via a series of spawns
and other programs), DOS gets confused and never returns to the
original compiled batch file. Neither can you start a compiled
batch file from a normal batch file. This happens because the
command interpreter (COMMAND.COM) loses track of who was doing
what. BatLite gives COMMAND.COM a hand, but only for those
versions of MS-DOS which I have tested.
I will add support for additional DOS versions on demand. If
you have a DOS version not listed here, or if compiled batch
files do not seem to be re-entrant, send me a system diskette
with COMMAND.COM and DEBUG on it. I'll add the necessary
support to BatLite, and send you your diskette back with a
complimentary copy of BatLite. I'll do this for the first
person to send me any particular version, and I don't think
it's worth looking at DOS versions before 2.11.
Some normal DOS commands are so poorly implemented that the
temptation to improve on God's work was irresistible. I plead
the case that these enhancements will be most useful in
installation-type batch files, which cannot run as actual .BAT
files anyway (a batch file cannot survive if you remove the
diskette it was sitting on). If you want to keep your batch
files 100% DOS compatible, don't rely on these improvements:
1. The IF EXIST command will work for subdirectories as
well as for normal files. For example:
if not exist c:\abcdemo mkdir c:\abcdemo
The classic IF EXIST command works with directories,
but only if they contain one or more files:
if not exist c:\abcdemo\*.* ...
2. BatLite emulates DOS's action in halting after a second
batch file is called from inside the first. If you do
not want this to happen, run BatLite with the
`/Nobatch' switch. Then, if you start a second batch
file from the compiled batch file, the compiled batch
file does not halt, but continues with the next
3. The EXIT command has the effect of halting the batch
file. This is a useful subsititute for using a goto
statement to jump to the end of a batch file.
91/08/23 1.0 Limited beta-test release.
91/08/28 1.1 General release. Added full support for
IF statement, environment variables, and
91/08/30 1.11 Maintenance release. Corrected handling
of @ at start of line.
91/09/01 1.2 General release. Added re-entrancy
support for MS-DOS versions 2.11, 3.20,
3.30, 4.01, and 5.00.
91/09/15 1.3 General release. Optimised code, and
improved memory allocation strategy.
Corrected bug in handling of `IF EXIST'
command. Added ability to call compiled
batch file from standard batch file for
MS-DOS versions 2.11, 3.20, 3.30, 4.01,
91/11/10 1.31 Maintenance release. Corrected handling
of `IF %sym%==...' command, which blocked
the machine. Added support for EXIT
command. Increased maximum size of batch
file from 16k to 48k. Corrected handling
of SET command and environment variables;
these did not work correctly.
92/02/20 1.4 General release. Improved the BatLite
command line to accept wildcards. Added
emulation of DOS in respect to one batch
file halting after starting another.
Compiled batch files now return the last
errorlevel. Added /NoBatch switch to
92/02/21 1.41 Maintenance release. Improved handling of
Ctrl-C so that compiled batch file halts
cleanly. Ctrl-Break is no longer handled.
92/03/14 1.5 General release. Version 1.41 contained a
bug which caused compiled .BAT files to
halt prematurely. Added /NoCtrlC switch
to BatLite, and improved handling of Ctrl-
C in compiled batch file.