Command Prompt

Command Prompt (cmd.exe) is the command-line interpreter on Microsoft Windows operating systems. It provides a text-based interface for executing commands, scripts, and programs. Unlike the older DOS shell, modern cmd supports batch scripting (batchfile), environmental variable expansion, and redirection.

Evolution & Context

  • Historically rooted in MS-DOS COMMAND.COM.
  • Often contrasted with PowerShell, which offers object-oriented pipelines and greater extensibility.
  • Compatible with WSL (Windows Subsystem for Linux) for running Linux binaries natively or via virtualization.

Key Features

  • Batch Processing: Executes .bat or .cmd scripts sequentially.
  • Environment Variables: Accesses system variables like %PATH% and %USERPROFILE%.
  • Redirection & Piping: Supports standard Unix-like I/O redirection (>, >>, <) and piping (|).

Integration with GNU Tools

Recent developments have expanded the native capabilities of cmd by porting Unix-standard utilities directly to Windows, reducing reliance on WSL or third-party emulation layers like Cygwin/MSYS2.

Common Commands

CommandDescription
dirList directory contents.
cdChange current directory.
clsClear screen.
echoDisplay messages or set variables.
typeDisplay file content (equivalent to cat).

References