Saturday, October 4, 2008

CMD - Command Prompt

Command Prompt may stand for:


Command line interpreter

RT-11 running on UKNC

RT-11 running on UKNC
Sample screenshot of the command line interpreter Bash.

Sample screenshot of the command line interpreter Bash.
Screenshot of Windows PowerShell, a .NET-based command line interpreter.

Screenshot of Windows PowerShell, a .NET-based command line interpreter.
The Windows Recovery Console has its own command line interpreter.

The Windows Recovery Console has its own command line interpreter.

A command line interpreter (also command line shell, command language interpreter) is a computer program that reads lines of text entered by a user and interprets them in the context of a given operating system or programming language.

Contents

Command interpreters as user interfaces

Command line interpreters allow users to issue various commands in a very efficient (and often terse) way. This requires the user to know the names of the commands and their parameters, and the syntax of the language that is interpreted. From the 1960s onwards, user interaction with computers was primarily by means of command line interfaces.

In the 1970s, researchers began to develop graphical user interfaces (GUIs) to provide an alternative user interface for computers, whereby commands were represented by pictorial operations, rather than as textual descriptions. Since they are easier to learn than command line interfaces, they have become the most common way of interacting with a computer. However, command line interpreters remain widely used in conjunction with GUIs. For some complex tasks, the latter are less effective because of the large number of menus and dialog boxes presented and because of the innate difficulty of representing the underlying task graphically.

Scripting

Most command line interpreters support scripting, to various extents. (They are, after all, interpreters of an interpreted programming language, albeit that in many cases the language is unique to the particular command line interpreter.) They will interpret scripts (variously termed shell scripts or batch files) written in the language that they interpret. Some command line interpreters also incorporate the interpreter engines of other languages, such as REXX, in addition to their own, allowing the executing of scripts, in those languages, directly within the command line interpreter itself.

Conversely, scripting programming languages, in particular those with an eval function (such as REXX, Perl, Python, or Jython), can be used to implement command line interpreters. For a few operating systems, most notably DOS, such a command interpreter provides a more flexible command line interface than the one supplied. In other cases, such a command interpreter can present a highly customised user interface employing the user interface and input/output facilities of the language.


Command Prompt (Windows)

Command Prompt
(A component of Microsoft Windows)

Command Prompt in Windows Vista
Included with Windows NT
Windows CE
OS/2
Replaces COMMAND.COM
Related components
Windows PowerShell
Batch file

cmd.exe is the command line interpreter on OS/2, Windows CE and on Windows NT-based operating systems (including Windows 2000, XP, Vista, Server 2003 and Server 2008). It is the analog of COMMAND.COM in MS-DOS and Windows 9x systems, or of the Unix shells used on Unix-like systems.

Contents

Versions

Therese Stowell developed the initial version of cmd.exe for Windows NT.[1] Although some old DOS commands are not supported or have been changed (e.g. the functionality of deltree was rolled into rd in the form of the /s parameter), cmd.exe still has a greater number of built-in commands.

Both the OS/2 and the Windows NT versions of cmd.exe have more detailed error messages than the blanket "Bad command or file name" (in the case of malformed commands) of command.com. In the OS/2 version of cmd.exe, errors are reported in whatever the current language of the system is, their text being taken from the system message files. The help command can then be issued with the error message number to obtain further information.

cmd.exe, which remains part of Windows Vista and Windows Server 2008 for backward compatibility, will be supplemented with Windows PowerShell, Microsoft's new extensible command line shell and task-based scripting technology.

Technical information

Unlike COMMAND.COM, which is a DOS program, cmd.exe is a native program for the platform. This allows it to take advantage of features available to native programs on the platform and not available to DOS programs. For example, since cmd.exe is a native text-mode application on OS/2, it can use real pipes in command pipelines, allowing both sides of the pipeline to run concurrently. As a result, it is possible to redirect the standard error in cmd.exe, unlike COMMAND.COM. (COMMAND.COM uses temporary files, and runs the two sides serially, one after the other.)

Technically, cmd.exe is a Windows program that acts as a DOS-like command line interpreter. It is generally compatible, but provides extensions which address the limitations of COMMAND.COM:

  • SETLOCAL/ENDLOCAL commands limit the scope of changes to the environment
  • internal CALL and GOTO labels lessen the need for individual batch files to perform parts of a task.
  • filename-parsing extensions to the SET command are comparable to C shell.
  • an expression-evaluation extensions is also provided in the SET command.
  • an expansion of the FOR command to support parsing files and arbitrary sets in addition to filenames.
  • use of arrow keys to scroll through command history (provided by the DOSKEY.EXE in command.com extension)
  • off-by-default path completion capabilities similar to bash tab completion
  • a directory stack accessible with the PUSHD and POPD commands
  • IF can perform case-insensitive comparisons and numeric equality and inequality comparisons in addition to case-sensitive string comparisons

The extensions can be disabled, providing a stricter compatibility mode.

See also

References

^ Zachary, G. Pascal (1994). Showstopper! The Breakneck Race to Create Windows NT and the Next Generation at Microsoft. Warner Books. ISBN 0-02-935671-7

No comments: