COMMAND


Type: External (2.0 and later)

Syntax:

COMMAND
COMMAND [d:][path] [device] [/P][/E:(size)] [/MSG] [/Y [/C (command)|
/K (command)]

Purpose: Reloads the DOS command processor (the program that loads the DOS internal programs) or starts a new command processor.

Discussion

Using this command with no options loads a new command processor with the DOS internal programs. Starting a new command processor also creates a new command environment (SET commands are canceled).

The command processor is loaded in two parts: the transient component and the memory-resident component. The memory-resident part resides in a portion of memory that can occasionally be overwritten by application programs. If that happens, DOS will discover that the memory-resident portion is missing and it will attempt to go to the disk to reload the transient portion from the COMMAND.COM program. If COMMAND.COM cannot be found, DOS will terminate operations until the COMMAND program can reload.

Options

device - Specifies a new input/output device at the time the new command processor is loaded.

/C (string) - Performs the command indicated by the string and then returns to the original command processor.

/E:(size) - Specifies the environment size. The size can be from 160 to 32,768 bytes. The default value is 256 bytes.

/K (command) - Runs the specified command, program, or batch program and then displays the DOS command prompt. This option must be the last one on the COMMAND command line (new with DOS Version 6).

/P - Keeps the secondary command processor in memory from that point in time forward. The EXIT command cannot be used to stop the command processor. The only way to reload the original command processor is by restarting the system. This option should be used only when COMMAND is used with the SHELL command in the CONFIG.SYS file.

/MSG - Stores all error messages in memory. Useful only if you are running DOS from floppy disks. If you use the /MSG option you must also use the /P option.

/Y - Tells COMMAND.COM to step through the batch file that has been specified with the /C or /K options . This option is useful for debugging batch files (new with DOS Version 6).



Example

If you enter

command /c dir

DOS will load the secondary command processor, execute the DIR command to show the files on the current drive and directory, and then exit back to the original command processor.

You could use COMMAND.COM in your CONFIG.SYS file in the following way:

SHELL=[[dos-drive:]dos-path]COMMAND.COM[[d:]path][device] [/E:(size)]

[/P [/MSG]]



Back to the Easy DOS Command Index