Learn How to Use Command Prompt

Command Prompt (CMD) Guide for Beginners

What is Command Prompt?

Command Prompt (cmd.exe) is a command-line interpreter in Windows that lets you interact with your computer through text commands.Today we are going to learn how to use command prompt

Command Prompt interface screenshot showing dir, cd, and copy commands with annotations explaining each part of the Windows command-line environment.

Opening Command Prompt

Quick Methods:

  1. Windows Key + R → type cmd → Enter
  2. Search → type “cmd” or “Command Prompt”
  3. File Explorer → type cmd in address bar → Enter

Advanced (Run as Administrator):

  • Right-click Start Menu → “Command Prompt (Admin)”
  • Needed for commands requiring elevated privileges

Essential Navigation Commands

 View current directory

dir                     # Lists contents of current folder
dir /w                  # Wide format listing
dir /p                  # Pauses after each screen

 Change directory

cd folder_name          # Enter a folder
cd ..                   # Go up one level
cd \                    # Go to root of current drive
cd /d D:\Folder         # Switch to different drive/folder

 Drive management

D:                      # Switch to D: drive

Basic File Operations

 Create files/folders

mkdir folder_name       # Create new folder
type nul > file.txt     # Create empty file
echo text > file.txt    # Create file with content

 Copy files/folders

copy source.txt destination.txt
xcopy source destination /E   # Copy folders with subfolders
robocopy source destination /E  # More advanced copying

 Move/Rename

move old.txt new.txt
rename old.txt new.txt

 Delete

del file.txt            # Delete file
rmdir folder_name       # Delete empty folder
rmdir /s folder_name    # Delete folder with contents

System Information Commands

systeminfo              # Detailed system info
hostname                # Display computer name
whoami                  # Show current user
ver                     # Windows version
ipconfig                # Network information
ipconfig /all           # Detailed network info

Network Commands

ping google.com         # Test connection to website
tracert google.com      # Trace route to destination
netstat -an             # Show active connections

Useful Utilities

 Text display/manipulation

echo Hello World        # Display text
type file.txt           # Show file contents
more file.txt           # Show file page by page

 Find/search

find "text" file.txt    # Search for text in file
findstr "pattern" *.txt # Search with regex patterns

 Compare files

fc file1.txt file2.txt  # Compare two files

 Task management

tasklist                # Show running processes
taskkill /PID 1234      # Kill process by PID
taskkill /IM notepad.exe  # Kill by program name

Tips & Tricks

  1. Tab Completion: Press Tab to auto-complete file/folder names
  2. Command History: Up/Down arrows to cycle through previous commands
  3. Clear Screen: cls
  4. Help System: Append /? to any command for help
   cd /?
   dir /?
  1. Copy/Paste:
  • Right-click → Paste
  • Ctrl + C to cancel command
  • Ctrl + V to paste (in newer Windows versions)

Common Tasks Examples

 1. Create and navigate project structure

mkdir MyProject
cd MyProject
mkdir src docs tests

 2. Batch rename files

ren *.txt *.bak

 3. Check disk space

wmic logicaldisk get size,freespace,caption

 4. Create backup of important files

robocopy C:\Documents D:\Backup\Documents /E

 5. Schedule tasks (opens Task Scheduler)

control schedtasks

Practice Exercises

  1. Navigate to your Desktop and list all files
  2. Create a folder called “test” with 3 text files inside
  3. Copy those files to a backup folder
  4. Check your IP address and ping Google
  5. Create a batch file (.bat) with simple commands

Safety Notes

  • Be cautious with delete commands
  • Administrator mode gives full system access
  • Some commands can’t be undone
  • When in doubt, use /help or /? for command information

If you have any query , feel free to type in comment box !

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.