Command | Description | Example |
---|---|---|
help | Lists all available commands | help |
help [command] | Displays help information for a specific command | help dir |
[command] /? | Alternative way to display help for a command | dir /? |
cls | Clears the screen | cls |
exit | Closes the Command Prompt window | exit |
echo [text] | Displays messages or turns command echoing on/off | echo Hello World |
title [string] | Changes the title of the Command Prompt window | title My Console |
color [attr] | Changes the console foreground and background colors | color 0A |
prompt [text] | Changes the command prompt display | prompt $G |
date | Displays or sets the system date | date /t |
time | Displays or sets the system time | time /t |
Command | Description | Example |
---|---|---|
cd | Displays the current directory or changes directory | cd |
cd [path] | Changes to the specified directory | cd C:\Windows |
cd /d [drive:][path] | Changes drive and directory in one command | cd /d D:\Projects |
cd.. | Moves up one directory level | cd.. |
cd\ | Moves to the root directory of the current drive | cd\ |
pushd [path] | Changes directory and saves the previous directory | pushd C:\Temp |
popd | Returns to the directory saved by pushd | popd |
dir | Displays a list of files and subdirectories | dir |
tree | Graphically displays directory structure | tree |
chdir | Same as cd command | chdir |
Command | Description | Example |
---|---|---|
[drive]: | Changes to the specified drive | D: |
vol | Displays the disk volume label and serial number | vol |
label | Creates, changes, or deletes the volume label | label C: SYSTEM |
Command | Description | Example |
---|---|---|
copy [source] [destination] | Copies one or more files to another location | copy file.txt C:\backup |
xcopy [source] [destination] | Copies files and directory trees | xcopy C:\data D:\backup /s |
robocopy [source] [destination] | Robust file copy for large operations | robocopy C:\src D:\dst /mir |
move [source] [destination] | Moves files and renames files/directories | move file.txt C:\new |
ren [old] [new] | Renames a file or directory | ren old.txt new.txt |
rename | Same as ren command | rename old.txt new.txt |
del [file] | Deletes one or more files | del temp.txt |
erase | Same as del command | erase temp.txt |
md [directory] | Creates a new directory | md newfolder |
mkdir | Same as md command | mkdir newfolder |
rd [directory] | Removes a directory | rd oldfolder |
rmdir | Same as rd command | rmdir oldfolder |
type [file] | Displays the contents of a text file | type notes.txt |
more [file] | Displays output one screen at a time | more longfile.txt |
find "[string]" [file] | Searches for a text string in files | find "error" log.txt |
findstr "[string]" [file] | Searches for patterns in files using regular expressions | findstr "error" *.log |
fc [file1] [file2] | Compares two files and shows differences | fc file1.txt file2.txt |
attrib [+a/-a] [+h/-h] [+r/-r] [+s/-s] [file] | Displays or changes file attributes | attrib +h secret.txt |
comp [file1] [file2] | Compares the contents of two files | comp file1.txt file2.txt |
Command | Description | Example |
---|---|---|
icacls [file] | Displays or modifies access control lists (ACLs) | icacls file.txt |
cacls | Legacy command for ACLs (deprecated) | cacls file.txt |
Command | Description | Example |
---|---|---|
ipconfig | Displays all current TCP/IP network configuration values | ipconfig |
ipconfig /all | Displays full configuration information | ipconfig /all |
ipconfig /release | Releases the IP address for the specified adapter | ipconfig /release |
ipconfig /renew | Renews the IP address for the specified adapter | ipconfig /renew |
ping [host] | Sends ICMP echo requests to test network connectivity | ping google.com |
tracert [host] | Traces route to a network host | tracert google.com |
pathping [host] | Combines ping and tracert functionality | pathping google.com |
netstat | Displays active TCP connections, listening ports, etc. | netstat -ano |
nslookup [host] | Queries DNS to obtain domain name or IP address mapping | nslookup google.com |
getmac | Displays the MAC address for network adapters | getmac |
arp -a | Displays the ARP cache tables | arp -a |
route print | Displays the IP routing table | route print |
netsh | Network shell for advanced network configuration | netsh interface show interface |
telnet [host] [port] | Communicates with another host using Telnet protocol | telnet google.com 80 |
ftp [host] | Transfers files to and from FTP server | ftp ftp.example.com |
net use | Connects/disconnects from shared resources | net use Z: \\server\share |
Command | Description | Example |
---|---|---|
systeminfo | Displays detailed system configuration | systeminfo |
hostname | Displays the computer's hostname | hostname |
ver | Displays the Windows version | ver |
whoami | Displays the current username | whoami |
wmic | Windows Management Instrumentation Command-line | wmic os get caption |
tasklist | Displays all running processes | tasklist |
taskkill | Terminates running processes | taskkill /im notepad.exe |
schtasks | Schedules commands/programs to run periodically | schtasks /create /tn "Backup" /tr "backup.bat" /sc daily |
shutdown | Shuts down or restarts the computer | shutdown /r /t 0 |
powercfg | Controls power settings | powercfg /energy |
driverquery | Displays installed device drivers | driverquery |
chkdsk | Checks a disk and displays a status report | chkdsk C: |
sfc /scannow | Scans and repairs system files | sfc /scannow |
diskpart | Disk partitioning utility | diskpart |
format | Formats a disk for use with Windows | format D: /q |
Command | Description | Example |
---|---|---|
set | Displays, sets, or removes environment variables | set |
set [variable]=[value] | Creates or modifies an environment variable | set TEMP=C:\Temp |
setx | Sets environment variables permanently | setx TEMP C:\Temp |
path | Displays or sets the command search path | path |
Shortcut | Description |
---|---|
F1 | Repeats the letters of the last command line, one by one |
F2 | Displays a dialog asking user to "enter the char to copy up to" of the last command line |
F3 | Repeats the last command line |
F4 | Deletes current prompt text up to the entered character |
F5 | Pastes recently used commands (does not cycle) |
F6 | Pastes ^Z to the prompt |
F7 | Displays a selectable list of previously executed commands |
Alt+F7 | Clears command history |
F8 | Pastes recently used commands (cycles) |
F9 | Displays a dialog asking user to enter a command number (0-9) |
Ctrl+C | Halts the current command |
Ctrl+S | Pauses the current command |
Ctrl+M | Same as Enter key |
Ctrl+Home | Deletes the command line from cursor to beginning |
Ctrl+End | Deletes the command line from cursor to end |
Ctrl+← | Moves cursor left one word |
Ctrl+→ | Moves cursor right one word |
Ctrl+↑ | Scrolls up through command history |
Ctrl+↓ | Scrolls down through command history |
Ctrl+PageUp | Scrolls up one page |
Ctrl+PageDown | Scrolls down one page |
Alt+Space | Opens the Command Prompt window menu |
Tab | Auto-completes file/folder names |
Esc | Clears the current command line |
Insert | Toggles between insert and overwrite mode |
Command | Description |
---|---|
@echo off | Hides the prompt and commands in a batch file |
echo. | Prints a blank line in a batch file |
pause | Pauses execution and displays "Press any key to continue..." |
call [batchfile] | Calls one batch program from another |
start [program] | Starts a program in a new window |
goto [label] | Jumps to a labeled line in a batch file |
:label | Defines a label for goto commands |
if [condition] [command] | Conditional execution in batch files |
for [options] [command] | Loop command for batch files |
choice | Provides a list of options for user selection |
set /p var= | Prompts user for input and stores in variable |
%~dp0 | Expands to the drive letter and path of the batch file |