home *** CD-ROM | disk | FTP | other *** search
- BAT2EXEC
-
- Doug Boling - Volume 9, Issue 14 - August 1990
-
- Purpose: Compile your batch files for added speed. Large batch
- files often run annoyingly slowly. Compiling them with
- BAT2EXEC will increase both your productivity and satisfaction.
-
-
- Daily PC operations are almost unimaginable without the use of batch
- files. Everyone has his favorite collection of them, and some users
- have constructed complex batch files of thousands of bytes that push
- the batch langauge itself to its limits. Programs that expand the
- available batch file functions, such as Michael Mefford's BATCHMAN,
- encourage users to make even larger batch files.
-
- Unfortunately, however, batch files are also notoriously slow.
- It can be almost painful to watch them scroll down the screen a line
- at a time. A standard way to improve the speed of interpreted
- programs, such as batch files, is to compile them. That's where
- BAT2EXEC comes in.
-
- USING BAT2EXEC
-
- The full syntax for BAT2EXEC could hardly be simpler. Just enter:
-
- BAT2EXEC FILE.BAT
-
- where FILE.BAT is the name of your batch file. BAT2EXEC will then
- produce an executable .COM file with the name FILE.COM. If BAT2EXEC
- can't find the batch file, an error message will be printed. If
- BAT2EXEC can't understand a line in the batch file, it will print an
- error message indicating the line in the file in which it discovered
- the error.
-
- BAT2EXEC should not be used on every batch file. AUTOEXEC.BAT, for
- example, must remain a genuine batch file in order for COMMAND.COM to
- find it. Similarly, batch files that run terminate and stay resident
- utilities (TSRs) should not be compiled. The reason for this
- limitation lies in the DOS memory management structure: if a TSR is
- executed from a program compiled by BAT2EXEC, the memory used by
- BAT2EXEC itself will not be made available to the system after
- it terminates.
-
- Programs created by BAT2EXEC behave slightly differently from the
- batch files from which they were compiled. The .COM file does not
- echo each line to the screen as does the batch file, for example.
- Running other batch files does not cause the .COM program to end.
- Also, pressing Ctrl-Break does not present the message, "Terminate
- Batch file (y/n)." If Ctrl-Break is pressed and BREAK has been set
- on, the program simply terminates.
-
- The size of the resulting .COM file is somewhat larger than
- the batch file. Compiling a batch file containing a single REM
- statement results in a .COM file size of 68 bytes, illustrating the
- overhead of the setup and terminate routines. Program size increases
- quickly as routines are added then slows as the loaded routines are
- reused instead of new ones being added.
-
- Certainly, BAT2EXEC is not suitable for use on every batch
- file. Two and three line batch files are best left in their easy-to-
- alter and simple-to-understand ASCII format. However, for those batch
- files that have grown into long complex programs, BAT2EXEC is the
- answer.