Note: All options must precede any other arguments on the command line. The first non-option word on the command line will cause option processing to finish.
An instance of the 32-bit Command Interpreter is started with the CMD command.
The command interpreter first processes the contents of the CMD_CMD_INIT environment variable, if it has inherited one, as if it were a command tail, then it processes all of the command tails that have been passed to it.
If non-option arguments are supplied, they are treated as a command line to be executed. For compatibility with the 16-bit CMD supplied with IBM OS/2, if the first non-whitespace character in the command line is a pair of quotation marks, both it and the last quotation mark character on the line (if any) will be removed before the command line is executed.
Once these commands have been executed, the command interpreter by default enters interactive mode, unless the /C option has been specified.
The return code from the command interpreter is the return code from the last command to be run. If the /C option is used, this will be the return code from the command given in the arguments. This is different from the 16-bit CMD supplied with IBM OS/2, which usually, but not always, returns the code of the last relevant system error generated when running (or trying to invoke) the command.
In interactive mode, the CMD command repeatedly prints a prompt to its standard output and reads a line of text from its standard input. Each line of text is treated as a command line to be executed. To exit interactive mode, and thereby terminate the command interpreter process, use the built-in EXIT command.
The editing keys used to edit the command line being entered are determined by the operating system and its console driver, and may vary from one operating system to another. The console driver in IBM OS/2, for example, uses the same editing keys as MS-DOS/PC-DOS.