[Toc][Index]

Batch File Compression


You can compress your batch files with a program called BATCOMP.EXE, which 
is distributed with CMD.EXE.  This program condenses 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 
regular .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 the compressed files are 
used. 
The full syntax for the batch compression program is 


        BATCOMP [/O] input file [output file ]

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.  BATCOMP will also add a .BTM extension if you specify a base 
name for the output file without an extension.  For example, to compress 
MYBATCH.CMD and save the result as MYBATCH.BTM, you can use any of these 
three commands: 


        [c:\] batcomp mybatch.cmd
        [c:\] batcomp mybatch.cmd mybatch
        [c:\] 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. 
JP Software does not provide a decompression utility to decompress batch 
files.  If you use BATCOMP.EXE, make sure that you also keep a copy of the 
original batch file for future inspection or modification. 
BATCOMP is a DOS and OS/2 character-mode application designed to run in 
any environment where our command processors run.  Each of our command 
processors includes the same version of BATCOMP.EXE, and a batch file 
compressed with any copy of BATCOMP can be used with any current JP 
Software command processor. 
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 traditional .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). 
Each of our command processors includes its own version of BATCOMP.EXE, 
set up to run under the corresponding operating system.  However, the 
output produced by each program is the same, so a batch file compressed 
with any version of BATCOMP can be used with any JP Software command 
processor. 
If you plan to distribute batch files to users of different platforms, see 
Special Character Compatibility. 

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs