BATCH

Execute a batch file.

Syntax

BATCH [/ERROR][/NOOUT][/ARGUMENTS= "arg1[,arg2]" "filename"

Parameters

/ERROR

Stops the execution of commands if the debugger detects an error, and returns to interactive mode.

/NOOUT

Cancels any update of windows during execution of a batch file.

/ARGUMENTS="arg1[,arg2…]"

Passes arguments to batch files. Up to 39 arguments are permitted. An argument is referenced using &argument-number. The argument 0 contains the name of the batch file. Undefined parameters are treated as empty strings. Values and debugger variables can be passed as arguments, whereas strings are not permitted. If you want to pass a string to the batch file, you need to use the PRINT command first. For example:

PRINT /DBVAR=test "mytest"

This command assigns the string mytest to the debugger variable test.

BATCH /ARGUMENTS="@test" "batch.xdb"

This command passes the debugger variable with the value mytest to the batch file.

filename

The name of the batch file.

Description

This command executes the specified batch file filename. To avoid problems with pathnames including special characters, the filename must be enclosed in double quotes.

Example

BATCH /ERROR "validateat"
BATCH "../cmddir/setup"

The following example demonstrates the usage of passing arguments to a batch file. The contents of the example batch file is:

! batch.xdb:
PRINT "start batch\n"
evaluate &1
evaluate /ascii &1
evaluate &2
PRINT "end batch\n"

The following commands are entered on the command line:

PRINT /DBVAR=test "mytest

"The debugger variable test is set to mytest.

BATCH /ARGUMENTS="@test,2" "c:\tmp\batch.xdb

"The batch file c:\tmp\batch.xdb is started and the arguments @test (=mytest) and 2 are passed to the batch file.

The batch file runs and executes the following commands:

PRINT "start batch\n

start batch is printed to the Console window.

eval &1

The value of argument 1 (@test) is displayed in the Console window.

eval /ascii &1

The value of argument 1 (@test) is displayed as entire string in the Console window.

eval &2

The value of argument 2 is displayed in the Console window.

PRINT "end batch\n"

end batch is printed to the Console window.

See Also

For more complete information about compiler optimizations, see our Optimization Notice.