What Is Command Prompt?
Command Prompt (often called cmd) is a text-based program in Windows that lets you control your computer by typing commands instead of clicking with a mouse.
Instead of:
You type instructions directly to the operating system.
It is also called a Command-Line Interface (CLI).
How to Open Command Prompt
Method 1:
cmdMethod 2:
You’ll see something like:
C:\Users\YourName>
This is called the prompt. It shows your current location (directory).
Understanding Directories (Folders)
In Command Prompt:
C:\Example path:
C:\Users\John\Documents>
This means:
Basic Navigation Commands
Show Files and Folders
dir
This lists everything in the current directory.
Change Directory
cd foldername
Example:
cd Documents
Go back one level:
cd ..
Go to root of drive:
cd \
Creating and Deleting Things
Create a Folder
mkdir MyFolder
or
md MyFolder
Delete a Folder
rmdir MyFolder
If the folder has files inside:
rmdir /s MyFolder
Create a File
type nul > file.txt
Delete a File
del file.txt
Viewing File Contents
type file.txt
This prints the file’s content to the screen.
Clearing the Screen
cls
This clears everything from the screen.
Running Programs
You can run programs by typing their name.
Example:
notepad
You can also run executable files:
program.exe
If the program is not in the current folder, you must give the full path:
"C:\Program Files\App\program.exe"
Getting Help
To see available commands:
help
To get help for a specific command:
help dir
Important Concepts
1. Case Sensitivity
Windows Command Prompt is NOT case-sensitive.
These are the same:
DIR dir Dir
2. Paths
There are two types of paths:
Absolute path:
C:\Users\John\Documents
Relative path:
Documents
Absolute starts from drive root.
Relative starts from current location.
3. Command Syntax Structure
Most commands follow this pattern:
command option target
Example:
rmdir /s MyFolder
Simple Practice Session
Example session:
dir mkdir TestFolder cd TestFolder type nul > hello.txt dir type hello.txt cd .. rmdir /s TestFolder cls
What this does:
dir
cd foldername
cd ..
cd \
mkdir MyFolder
md MyFolder
rmdir MyFolder
rmdir /s MyFolder
type nul > file.txt
del file.txt
type file.txt
cls
notepad
program.exe
"C:\Program Files\App\program.exe"
help
help dir
dir
mkdir TestFolder
cd TestFolder
type nul > hello.txt
dir
type hello.txt
cd ..
rmdir /s TestFolder
cls