Call

Index

Invokes a batch file, executable program, or Dos command.

Syntax:

CALL batchfilename [batchfileparameters]

Notes:

  1. CALL is used in batch files to invoke a second batch file as a sub-routine. When the sub-routine finishes, control returns to the parent batch file. This is in contrast to simply invoking a secondary batch file by name, in which case control does not return to the primary batch file.

  2. CALL will also work with Dos commands and programs. However, there is little point in doing this as in both cases these can be invoked directly from the batch file and control will be returned on completion.

  3. Parameters and switches (except /?) can be passed on to the secondary batch file, either explicitly, as variables generated by the primary file, or as replaceable variables holding data entered on the original command line.

  4. CALL does not start a secondary command processor (c.f. START) and so any environmental variables set in the secondary batch file will be valid when control is returned to the primary.

  5. Because CALL is internal, it does not generate an Exit Code on completion. However, Exit Codes generated by (external) commands/programs within the secondary batch file will be available for use by the primary when control is returned to it.

  6. Pipes ( | ) and redirection symbols (<<,<, and >) should not be used with the CALL command.

Examples:

To run "checknew.bat" from within another batch program:
CALL checknew

If the parent batch program accepts two replaceable parameters and these are to be passed on to "checknew.bat":
CALL checknew %1 %2

File Details:

Internal


This page last revised:
June 4, 2001.