Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
COMMAND
◄Notes► ◄Examples►
────────────────────────────────────────────────────────────────────────────
COMMAND
Starts a new instance of the MS-DOS command interpreter.
A command interpreter is a program that lets you type commands. Use the EXIT
command to stop the new command interpreter and return control to the old
one.
Syntax
COMMAND [[drive:]path] [device] [/E:nnnnn] [/Y [/C command|/K command]]
In your CONFIG.SYS file, use the following syntax:
SHELL=[[dos-drive:]dos-path]COMMAND.COM [[drive:]path][device]
[/E:nnnn] [/P [/MSG]]
Parameters
[drive:]path
Specifies the directory in which the command interpreter is to look for
the COMMAND.COM file when the transient part of the program needs to be
reloaded. This parameter must be included when loading COMMAND.COM for
the first time if the COMMAND.COM file is not located in the root
directory. This parameter is used to set the COMSPEC environment
variable. For more information, see Transient and Resident Memory in
<COMMAND──Notes>.
device
Specifies a different device for command input and output. For more
information about this parameter, see the <CTTY> command.
[dos-drive:]dos-path
Specifies the location of the COMMAND.COM file.
Switches
/C command
Specifies that the command interpreter is to perform the specified
command and then exit. This switch must be the last switch on the
command line.
/E:nnnnn
Specifies the environment size, where nnnnn is the size in bytes. The
value of nnnnn must be in the range 160 through 32768. MS-DOS rounds
this number up to a multiple of 16 bytes. The default value is 256.
/K command
Runs the specified command, program, or batch program and then displays
the MS-DOS command prompt. This switch must be the last switch on the
COMMAND command line.
This switch is particularly useful for specifying a startup batch file
for the MS-DOS Prompt in Windows (much like AUTOEXEC.BAT for MS-DOS). To
do this, open the DOSPRMPT.PIF file using the PIF Editor, and type the
/K switch in the Optional Parameters box. It is not recommended to use
the /K switch on the SHELL command line in your CONFIG.SYS file; doing
so can cause problems with applications and installation programs that
make changes to your AUTOEXEC.BAT file.
/P
Should be used only when COMMAND is used with the SHELL command in the
CONFIG.SYS file. The /P switch makes the new copy of the command
interpreter permanent. In this case, the EXIT command cannot be used to
stop the command interpreter. If you specify /P, MS-DOS runs your
AUTOEXEC.BAT file before displaying the command prompt. If there is no
AUTOEXEC.BAT file in the root directory of the startup drive, MS-DOS
carries out the DATE and TIME commands instead. If you do not have a
SHELL command in your CONFIG.SYS file, COMMAND.COM is automatically
loaded from the root directory with the /P switch.
/MSG
Specifies that all error messages should be stored in memory. Usually,
some messages are stored only on disk. This switch is useful only if you
are running MS-DOS from floppy disks. You must specify the /P switch
when you use the /MSG switch. For more information about using the /MSG
switch, see <COMMAND──Notes>.
/Y
Directs COMMAND.COM to step through the batch file specified by the /C
or /K switches. This switch is useful for debugging batch files. For
example, to step through the TEST.BAT batch file line by line, you would
type COMMAND /Y /C TEST. The /Y switch requires either the /C or the /K
switch.
Related Command
The <SHELL> command is the preferred method of using COMMAND to permanently
increase space for the environment table.
♦