Introduction
💻 Windows Command Prompt (cmd.exe) is the default
command-line interpreter for Windows.
This guide collects the main commands to navigate, manage files, and
check system info efficiently.
Navigating the
Filesystem
cd |
Change directory |
cd C:\Users\YourName\Documents |
dir |
List files in directory |
dir |
md / mkdir |
Create a new directory |
mkdir Projects |
rd / rmdir |
Remove a directory |
rmdir OldFolder |
cls |
Clear the screen |
cls |
REM Practical example
cd C:\Users\YourName\Documents
dir /w
💡 Tip: Use dir /a to show hidden files.
File Management
copy |
Copy files |
copy file.txt backup.txt |
move |
Move or rename files |
move file.txt C:\Data\file.txt |
del |
Delete files |
del old.txt |
type |
Display file contents |
type notes.txt |
more |
Scroll through file content |
type long.txt \| more |
REM Practical example
copy file.txt backup.txt REM copies a file
move file.txt C:\Data\file.txt REM moves or renames a file
del old.txt REM deletes a file
type notes.txt REM displays content of a file
type long.txt | more REM scrolls through file content
⚠️ Warning: Use del carefully as it permanently
deletes files.
Disk and Directory
Utilities
chkdsk |
Check disk for errors |
chkdsk C: |
diskpart |
Disk partition tool |
diskpart |
tree |
Show folder structure |
tree C:\Users\YourName /F |
fsutil |
Advanced file system info |
fsutil fsinfo drives |
Networking
Commands
ping |
Test network connectivity |
ping google.com |
ipconfig |
Display IP configuration |
ipconfig /all |
tracert |
Trace route to host |
tracert google.com |
netstat |
Show active connections |
netstat -an |
nslookup |
DNS query |
nslookup example.com |
Environment
Variables
set |
List or set environment variables |
set PATH |
echo |
Display messages |
echo Hello World |
pause |
Pause script execution |
pause |
exit |
Close the command prompt |
exit |
✅ Note: Combine commands using && or
| for conditional execution or piping output.
⬅ Back to Home