If you're learning Windows Command Prompt (CMD), one of the first things you should know is how to create, open, navigate, and delete folders using commands.
These basic folder management commands are useful for beginners, programmers, and anyone who wants to work faster without using File Explorer.
This guide explains everything step-by-step.
📌 What is a Folder in CMD?
A folder (also called a directory) is a location where files and other folders are stored.
Using CMD, you can:
Create folders
Open folders
Move between folders
View folder contents
Delete folders
💻 How to Open CMD
Method 1
Press:
Windows + R
Type:
cmd
Press Enter
Command Prompt will open.
📁 Create a New Folder
Using the MD Command
MD stands for:
Make Directory
Example:
md MyFolder
This creates a folder named:
MyFolder
Alternative Command
You can also use:
mkdir MyFolder
Both commands perform the same task.
📂 View Available Files and Folders
Use:
dir
This command displays all files and folders in the current location.
📁 Open a Folder
To move into a folder, use the CD command.
CD stands for:
Change Directory
Example:
cd MyFolder
You are now inside the folder.
Check Current Location
Use:
cd
CMD will display your current directory path.
📂 Create a Folder Inside Another Folder
Example:
md Projects
cd Projects
md HTML
Result:
Projects
└── HTML
A folder named HTML is created inside Projects.
⬅️ Go Back to Previous Folder
Use:
cd ..
This moves you one level back.
❌ Delete an Empty Folder
Use:
rd MyFolder
OR
rmdir MyFolder
The folder must be empty before deletion.
🗑️ Delete a Folder with Files Inside
To remove a folder and all its contents:
rmdir /s MyFolder
CMD will ask for confirmation.
Press:
Y
to continue.
⚡ Delete Folder Without Confirmation
Use:
rmdir /s /q MyFolder
Explanation:
/s= Delete folder and contents/q= Quiet mode (no confirmation)
⚠️ Use carefully because deleted files cannot be easily recovered.
🚀 Useful Folder Commands Summary
| Command | Function |
|---|---|
| md FolderName | Create folder |
| mkdir FolderName | Create folder |
| dir | View files & folders |
| cd FolderName | Open folder |
| cd .. | Go back one folder |
| rd FolderName | Delete empty folder |
| rmdir /s FolderName | Delete folder with files |
| rmdir /s /q FolderName | Force delete folder |
🛡️ Important Tips
Double-check folder names before deleting
Avoid using force delete unless necessary
Use
dirfrequently to verify locationPractice inside a test folder first
📝 Final Words
Learning how to create, open, and delete folders using CMD is one of the most important beginner skills in Windows Command Prompt. These commands are simple, fast, and used in many advanced scripting and automation tasks.
Once you master these basics, you'll be ready to learn more powerful CMD commands.
For more Windows CMD tutorials and tricks, visit CodeSardar.
❓ Frequently Asked Questions
Q1. What is the difference between MD and MKDIR?
There is no difference; both create folders.
Q2. Can CMD delete folders with files inside?
Yes, using rmdir /s.
Q3. How do I go back one folder level?
Use:
cd ..
