Command Prompt (CMD) is a command-line interpreter in Windows operating systems that allows users to execute commands and perform various tasks by typing text-based commands. It provides direct access to the system’s core functions, such as file management, network configurations, and troubleshooting. CMD is widely used by IT professionals and developers for scripting, automation, and administrative tasks.
How to Open CMD:
Press Win + R to open the Run dialog box.
Type cmd and press Enter.
Alternatively, you can search for “Command Prompt” in the Start menu.
Basic Navigation Commands:
Command
Description
Example
CD
(Change Directory): Changes the current directory to another directory.
cd C:\Users\YourName\Documents
DIR
(Directory): Lists all files and folders in the current directory.
dir
MKDIR
(Make Directory): Creates a new directory.
mkdir NewFolder
RMDIR
(Remove Directory): Deletes a directory.
rmdir OldFolder
CLS
(Clear Screen): Clears the Command Prompt screen.
cls
File Management Commands:
Command
Description
Example
copy
Copies files from one location to another.
copy file.txt D:\Backup
move
Moves files from one location to another.
move file.txt D:\NewLocation
del
(Delete): Deletes one or more files.
del file.txt
ren
(Rename): Renames a file or directory.
ren oldname.txt newname.txt
attrib
Displays or changes file attributes (e.g., read-only, hidden).
“attrib +r file.txt “-(makes the file read-only)
System Information Commands:
Command
Description
Example
systeminfo
Displays detailed system information, including OS version, memory, and network information.
systeminfo
ipconfig
Displays network configuration details, such as IP address and DNS.
ipconfig /all
tasklist
Displays a list of currently running processes.
tasklist
taskkill
Terminates a running process using its process ID (PID) or name.
taskkill /PID 1234 or taskkill /IM notepad.exe
chkdsk
(Check Disk): Checks a disk and displays a status report, optionally fixing issues.
chkdsk C: /f
Network Commands:
Command
Description
Example
ping
Tests the network connection to a specific IP address or domain.
ping google.com
tracert
(Trace Route): Traces the path that data takes to reach a specific IP address or domain.
tracert google.com
netstat
Displays network statistics and active connections.
netstat -an
nslookup
Queries DNS to obtain the IP address of a domain or the domain of an IP address.
nslookup example.com
arp
(Address Resolution Protocol): Displays and modifies the IP-to-MAC address translation table.
arp -a
Disk Management Commands:
Command
Description
Example
diskpart
Launches the Disk Partition tool for managing disks, partitions, and volumes.
diskpart
format
Formats a disk for use with Windows.
format D
iskmgmt.msc
Opens the Disk Management utility.
iskmgmt.msc
System Control Commands:
Command
Description
Example
shutdown
Shuts down, restarts, or logs off the computer.
shutdown /s (shutdown), shutdown /r (restart)
sfc
(System File Checker): Scans and repairs corrupted system files.
sfc /scannow
powercfg
Manages power settings and configurations.
powercfg /hibernate off
regedit
Opens the Windows Registry Editor.
regedit
Advanced Commands:
Command
Description
Example
echo
Displays messages or turns on/off command echoing.
echo Hello, World!
path
Displays or sets the path environment variable.
path or path C:\Program Files\Java\jdk1.8.0_131\bin
set
Displays, sets, or removes environment variables.
set or set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
assoc
Displays or modifies file extension associations.
assoc .txt=txtfile
Batch File Commands:
Command
Description
Example
pause
Pauses the execution of a batch file and displays a message.
pause
if
Performs conditional processing in batch programs.
if “%username%”==”Admin” echo Hello Admin
goto
Directs the command processor to a labeled line in a batch file.
goto label
General Commands
ASSOC: Displays or modifies file extension associations.
AT: Schedules commands and programs to run on a computer.
ATTRIB: Displays or changes file attributes.
BREAK: Sets or clears extended CTRL+C checking.
COLOR: Sets the default console foreground and background colors.
DATE: Displays or sets the date.
ECHO: Displays messages or turns command echoing on or off.
EXIT: Exits the command prompt or a batch file.
FOR: Runs a specified command for each file in a set of files.
FTYPE: Displays or modifies file types used in file extension associations.
GOTO: Directs the command interpreter to a labeled line in a batch program.
HELP: Provides Help information for Windows commands.
LABEL: Creates, changes, or deletes the volume label of a disk.
PAUSE: Suspends the processing of a batch file and displays a message.
REM: Records comments (remarks) in batch files or CONFIG.SYS.
SET: Displays, sets, or removes environment variables.
SETLOCAL: Begins localization of environment changes in a batch file.
SHIFT: Shifts the position of replaceable parameters in batch files.
START: Starts a separate window to run a specified program or command.
TIME: Displays or sets the system time.
TITLE: Sets the window title for a CMD.EXE session.
VER: Displays the Windows version.
VERIFY: Tells Windows whether to verify that your files are written correctly to a disk.
VOL: Displays a disk volume label and serial number.
File and Directory Commands
CD: Displays the name of or changes the current directory.
CHDIR: Same as CD.
CLS: Clears the screen.
COPY: Copies one or more files to another location.
DEL: Deletes one or more files.
DIR: Displays a list of files and subdirectories in a directory.
ERASE: Same as DEL.
MKDIR: Creates a directory.
MOVE: Moves one or more files from one directory to another directory.
RMDIR: Removes a directory.
TREE: Graphically displays the directory structure of a drive or path.
XCOPY: Copies files and directory trees.
Disk and File System Commands
CHKDSK: Checks a disk and displays a status report.
DISKPART: Displays or configures Disk Partition properties.
FORMAT: Formats a disk for use with Windows.
DISKCOMP: Compares the contents of two floppy disks.
DISKCOPY: Copies the contents of one floppy disk to another.
LABEL: Creates, changes, or deletes the volume label of a disk.
SUBST: Associates a path with a drive letter.
VOL: Displays the disk volume label and serial number.
FC: Compares two files or sets of files, and displays the differences.
ATTRIB: Displays or changes file attributes.
COMP: Compares the contents of two files or sets of files.
CONVERT: Converts FAT volumes to NTFS. You cannot convert the current drive.
DEFRAG: Disk defragmenter utility.
DISKSHADOW: Volume Shadow Copy Service administrative command-line tool.
RECOVER: Recovers readable information from a bad or defective disk.
REPLACE: Replaces files.
Networking Commands
ARP: Displays or modifies the IP-to-Physical address translation tables used by ARP.
IPCONFIG: Displays all current TCP/IP network configuration values.
PING: Sends ICMP echo requests to network hosts.
TRACERT: Traces the route to a remote host.
NETSTAT: Displays network connections, routing tables, and interface statistics.
NSLOOKUP: Queries DNS name servers for information about hosts and IP addresses.
ROUTE: Manipulates network routing tables.
NBTSTAT: Displays protocol statistics and current TCP/IP connections using NBT (NetBIOS over TCP/IP).
NETSH: Network services shell, a command-line scripting utility that allows you to, either locally or remotely, display or modify the network configuration of a computer that is currently running.
NET USE: Connects or disconnects a computer from a shared resource or displays information about computer connections.
NET VIEW: Displays a list of computers in a workgroup or the shared resources available on a computer.
System Information Commands
SYSTEMINFO: Displays detailed configuration information about a computer and its operating system, including operating system configuration, security information, product ID, and hardware properties such as RAM, disk space, and network cards.
TASKLIST: Displays a list of applications and services currently running on a system.
TASKKILL: Terminates tasks by process ID (PID) or image name.
SCHTASKS: Schedules commands and programs to run periodically or at a specific time.
GETMAC: Displays the MAC address for network adapters on a system.
SYSTEMINFO: Displays detailed configuration information about the computer and its operating system.
WMIC: Displays WMI information inside an interactive command shell.
Security Commands
CACLS: Displays or modifies access control lists (ACLs) of files.
ICACLS: Displays, modifies, backups, or restores ACLs for files and directories.
RUNAS: Allows a user to run specific tools and programs with different permissions than the user’s current logon provides.
CIPHER: Displays or alters the encryption of directories and files on NTFS volumes.
SFC: System File Checker, scans and verifies the versions of all protected system files.
Utility Commands
FC: Compares two files or sets of files and displays the differences.
FIND: Searches for a text string in a file or files.
FINDSTR: Searches for strings in files.
MORE: Displays one screen of output at a time.
SORT: Sorts input.
REPLACE: Replaces files.
SUBST: Associates a path with a drive letter.
DOSKEY: Edits command lines, recalls Windows commands, and creates macros.
FC: Compares two files or sets of files and displays the differences.
OPENFILES: Displays files opened by remote users.
PRINT: Prints a text file.
Advanced Commands
BCDEDIT: Sets properties in boot database to control boot loading.
BOOTCFG: Configures boot configuration data.
SC: Communicates with the Service Control Manager and services.
REGEDIT: Opens the Windows registry editor.
REG: Command-line tool for accessing the Windows registry.
GPRESULT: Displays Group Policy settings and Resultant Set of Policy (RSoP) for a user or a computer.
GPUPDATE: Updates Group Policy settings.
WUSA: Windows Update Standalone Installer.
WEVTUTIL: Retrieves information about event logs and publishers.