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
.bator.cmdscripts 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.
- Coreutils for Windows: Native Linux Commands in Command Prompt documents the official porting of GNU Core Utilities to Windows as native binaries.
- This update allows users to execute standard Linux commands (e.g.,
ls,cp,mv) directly withincmdwithout translation layers. - Source: Coreutils for Windows: Native Linux Commands in Command Prompt
- This update allows users to execute standard Linux commands (e.g.,
Common Commands
| Command | Description |
|---|---|
dir | List directory contents. |
cd | Change current directory. |
cls | Clear screen. |
echo | Display messages or set variables. |
type | Display file content (equivalent to cat). |