Commands and Argument detection

Commands and arguments are the two smallest piece of code in batch and are used to describe a single operation the interpreter can execute.

Argument detection

What pBat considers to be arguments is a set characters delimited by delimiters accepted by pBat which are colons (;), semicolons (;), comma (,), newlines, tabs and spaces. Thus the following line consists of two arguments:

COMMAND foo bar

However, as it is quite common to need to pass arguments to commands that contain one of the preceding delimiters, It is possible to use either quotation marks () or character escaping via ^ to override delimiters default behaviour :

COMMAND "foo bar"
COMMAND foo^ bar

Both preceding syntax are valid. Note that if using quote, characters outside the quotes can be appended or be preceding without any influence on the validity of the line, just like the following.

COMMAND foo"ta fu"bar

Note that normal control character like |, & or ( and ) are ignored when surrounded by quotation marks.

Commands

Commands are the simplest structure of batch programming. Every action is done using a command. Commands are lines (or a part of line, if conditonnal operators are used), that denote an action to be done. Typically, commands are described using the following syntax :

COMMAND mandatory_argument [optional_argument] [choice1 | choice2]

Where:

See also

Conditional operators, Redirections