Batch File Compression |
|
You can compress your .BTM files with BATCOMP. That command compresses batch files by about a third and makes them unreadable with the LIST command and similar utilities. Compressed batch files run at approximately the same speed as uncompressed .BTM files.
You may want to consider compressing batch files if you need to distribute them to others and keep your original code secret or prevent your users from altering them. You may also want to consider compressing batch files to save some disk space on the systems where compressed files are used.
The full syntax for the batch compression command is
BATCOMP [/Ekkkk /K][/Q][/O] InputFile [OutputFile]
You must specify the full name of the input file, including its extension, on the BATCOMP command line. If you do not specify the output file, BATCOMP will use the same base name as the input file and add a .BTM extension. For example, to compress MYBATCH.CMD and save the result as MYBATCH.BTM, you can use either one of these commands:
batcomp mybatch.cmd
batcomp mybatch.cmd mybatch.btm
If the output file (MYBATCH.BTM in the examples above) already exists, BATCOMP will prompt you before overwriting the file. You can disable the prompt by including /O on the BATCOMP command line immediately before the input file name. Even if you use the /O option, BATCOMP will not compress a file into itself.
By default, BATCOMP does not remove comment lines, i.e. lines starting with REM or ::, since in some instances, such as when a comment line occurs between a TEXT and ENDTEXT, the compressed file would behave differently from the original by not displaying the comment line. To override that default and force deletion of comment lines, use the /K option. Lines starting with "REM >" (used to create a new, empty file, or to delete the old contents of one) are never considered comments to be removed.
The /Q ("quiet") option suppresses informational messages from BATCOMP.
JP Software does not provide a utility to decompress batch files. If you use BATCOMP, make sure that you also keep a copy of the original batch file for future inspection or modification.
You can adopt one of two strategies for keeping track of your original source files and compressed batch files. First, you may want to create the source files with a .BAT or .CMD extension and reserve the .BTM extension for compressed batch files. The advantage of this approach is that you can modify and test the uncompressed versions at any time, although they will run in the slower, traditional mode unless they begin with a LOADBTM command.
If you prefer, you can use a .BTM extension for both the source and compressed files. In this case you will have to use a different directory or a different base name for each file. For example, you might use SOURCE\MYBATCH.BTM for the source file and COMP\MYBATCH.BTM for the compressed version, or use MYBATCHS.BTM for the source file and MYBATCH.BTM for the compressed file (however, the latter approach may make it more difficult to keep track of the correspondence between the source file and the compressed file).
If you plan to distribute batch files to users of different platforms, see Special Character Compatibility for important information on the command separator, escape character, and parameter character used in each product.
The BATCOMP command replaces the external program BATCOM32.EXE which was included in previous versions and is now obsolete.