command(CMD) 19 June 1992 command(CMD) Name command - start a new instance COMMAND.COM Syntax command [[drive:]path] [device] [/e:nnnnn] [/p] [/c string] [/msg] In your CONFIG.SYS file, use the following syntax: shell=[[dos-drive:]dos-path]command.com [[drive:]path] [device] /e:nnnn /p Description A command interpreter is a program that displays the command prompt at which you type commands. Use the exit command to stop the new command interpreter and return control to the old one. Parameters [drive:]path Specifies where 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 if COMMAND.COM is not located in the root directory. This parameter is used to set the COMSPEC environment variable. device Specifies a different device for command input and output. For more information about this parameter, see the ctty(CMD) command. [dos-drive:]dos-path Specifies the location of COMMAND.COM. Switches /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. /p Should be used only when command is used with the shell com- mand 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 batch pro- gram when it carries out the corresponding shell command. /c string Specifies that the command interpreter is to perform the com- mand specified by string and then stop. /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 the following ``Notes'' section. Notes Limits on environment size If nnnnn is less than 160 or greater than 32768, MS-DOS uses the default value of 256 bytes and displays the following message: Parameter value not in allowed range. Changing your terminal device You can specify a different device (such as AUX) for input and output by using the device parameter. For more information about device, see the ctty(CMD) command. Running multiple command interpreters When you start a new command interpreter, MS-DOS creates a new command environment. This new environment is a copy of the parent environment. You can change the new environment without affecting the old one. The default size of the new environment is 256 bytes or the size of the current environment rounded up to the next 16 bytes, whichever is larger. Use the /e switch to override the default size. (Note that the current environment refers to the memory actually being used, not to the environ- ment size specified with the previous /e switch.) Transient and resident memory MS-DOS loads the command interpreter into memory in two parts: the tran- sient part (in memory) and the resident part (on disk). Some programs write over the transient part of COMMAND.COM when they run. When this happens, the resident part must locate the COMMAND.COM file on disk to reload the transient part. The COMSPEC environment variable identifies where COMMAND.COM is located on the disk. If COMSPEC is set to a floppy disk drive, MS-DOS might prompt you to insert a disk that contains COMMAND.COM. Using the /msg switch Usually, MS-DOS keeps many error messages in the resident part of COMMAND.COM instead of using memory to store them. When MS-DOS needs to display one of these messages, MS-DOS retrieves the message from the disk containing COMMAND.COM. If you are running MS-DOS from floppy disks instead of from a hard disk, MS-DOS cannot retrieve such error messages unless you have the disk con- taining COMMAND.COM in drive A. If this disk is not present, MS-DOS dis- plays one of the following short messages instead of the full message: Parse error Extended error You can make sure MS-DOS displays complete error messages by using the /msg switch with command. This switch forces MS-DOS to keep these error messages in memory so that they are always available when needed. Use the /msg switch with command if you have a floppy disk system, unless you cannot afford to lose the memory used to store the error messages. You must also specify the /p switch when you use the /msg switch. Examples The following command specifies that the MS-DOS command interpreter is to start a new command interpreter from the current program, run a batch program named MYBAT.BAT, and then return to the first command inter- preter: command /c mybat.bat The following command specifies that COMMAND.COM is located in the DOS directory on drive C: c:\dos\command.com /e:1024 Since the full path for command is specified, MS-DOS sets the COMSPEC environment variable to C:\DOS\COMMAND.COM. This command also creates an environment of 1024 bytes for this command interpreter. Related command The shell command is the preferred method of using command to permanently increase space for the environment table. For more information about this alternative, see the shell(CMD) command.