TCC offers an external processor option for batch files that lets you define an external program to process a particular .CMD file. To identify a .CMD file to be used with an external processor, place the string EXTPROC as the first word on the first line of the file, followed by the name of the external program that should be called. TCC will start the program and pass it the name of the .CMD file and any command line parameters that were entered.

 

For example, suppose GETDATA.CMD contains the following lines:

 

EXTPROC D:\DATAACQ\DATALOAD.EXE

OPEN PORT1

READ 4000

DISKWRITE D:\DATAACQ\PORT1\RAW

 

Then if you entered the command:

 

[d:\dataacq] getdata /p17

 

TCC would read the GETDATA.CMD file, determine that it began with an EXTPROC command, read the name of the processor program, and then execute the command:

 

D:\DATAACQ\DATALOAD.EXE D:\DATAACQ\GETDATA.CMD /p17

 

The hypothetical DATALOAD.EXE program would then be responsible for reopening the GETDATA.CMD file, ignoring the EXTPROC line at the start, and interpreting the other instructions in the file. It would also have to respond appropriately to the command line parameter entered (/p17).

 

Do not try to use TCC as the external processor named on the EXTPROC line in the .CMD file. It will interpret the EXTPROC line as a command to reopen itself. The result will be an infinite loop that will continue until the computer runs out of resources and locks up.

 

TCC also provides SHEBANG support. It works identically to EXTPROC, but the first line begins with a #! .

 

Note that EXTPROC and SHEBANG only work with files with a .CMD extension, not .BTM or .BAT.