Programming Field

Command - DOS/Command Prompt Reference

Invokes the ‘Command Interpreter’. This command interpreter, commonly referred to as the MS-DOS Prompt, functions as a command-line shell in MS-DOS.

[64-bit versions Windows] It does not exist in 64-bit versions of Windows. (You also cannot bring in old data and execute Command.com.)

Syntax

command[.com] [[<drive>:]<path>] [<device>] [/E:nnnnn] [/P [/MSG]]
    [[/Y] /C <command> | /K <command>]
<drive> and <path> Specifies the drive path where command.com exists. This argument is essential when launching command.com for the first time, especially if command.com is not located in the root directory when starting in DOS mode.
<device> Specifies the device string for command.com input and output (CON, AUX, COM1, LPT1, etc.).
/E:nnnnn

Specifies the size of the environment variables used by command.com in bytes. nnnnn will be an integer value in the range of 160 to 32768, but command.com will use a value rounded to the nearest multiple of 16.

If this option is not specified, the size will be set to 256.

/P Residents in memory, preventing termination with Exit. This argument is commonly used when booting into DOS mode using a startup disk.
/MSG When specifying the /P option, use this to residently store error messages in memory. If this option is not specified, error messages will be simplified.
/Y Used in conjunction with the /C or /K option (specified before /C, /K). When executing a batch file, it displays a message prompting confirmation for each line of the file's content. Choosing option N during this confirmation skips the execution of that particular line.
/C <command> Executes the content specified in <command>. After execution, the ‘command.com’ that executed this command will terminate. Also, refer to the /K option.
/K <command> Executes the content specified in <command>. After execution, the ‘command.com’ that executed this command will not terminate but will display the MS-DOS prompt. When creating a shortcut for a batch file on Windows, using ‘command.com /K’ allows for consecutive execution of ‘Run the batch file’ → ‘MS-DOS Prompt’. This is useful when you want to display the MS-DOS prompt in specific environments (residential programs, environment variables, etc.).

Details

Command.com provides the display processing for the prompt (interactive interface) and executes batch files. It is necessary in MS-DOS when entering and executing other commands.

In Windows, the Virtual DOS feature allows the display of command.com within a window, enabling command input, and more (this is referred to as the ‘MS-DOS Prompt’).

[Windows NT series] In the Windows NT series (including XP and later), there is ‘cmd.exe’, but you can still use "command.com" deliberately to run older batch files. However, on 64-bit versions of Windows, command.com is not provided because it cannot execute 16-bit programs.

Samples

Sample 1

command /K setting.bat

Executes ‘setting.bat’ but displays the prompt after execution. This is used when displaying the prompt in a state where specific environment variables are set.

Sample 2 (Config.sys)

SHELL=C:\DOS\COMMAND.COM /P /MSG /E:4096

[MS-DOS] Sets ‘C:\DOS\COMMAND.COM’ as the default shell. When executing it as a shell, it is set to run with ‘/P’ (do not terminate), ‘/MSG’ (load error messages), and ‘/E:4096’ (setting environment variable size).

See also