cd, mkdir and rmdir: move between folders and make them
The Command Prompt is always "in" one folder, shown before the > sign. Commands act on that folder unless told otherwise. cd moves you to a different one. mkdir makes a new folder and rmdir removes one.
Where am I?
cd on its own prints the current folder.
C:\Users\asha\demo>cd
C:\Users\asha\demoGoing into a folder, and back out
C:\Users\asha\demo>cd photos
C:\Users\asha\demo\photos>dir /b
beach.jpg
hills.jpg
C:\Users\asha\demo\photos>cd ..Two dots mean "the folder above this one". The prompt changes each time to show where you are.
Paths
A path is the route to a folder. There are two kinds.
- A relative path starts from where you are:
photos, or..\old. - An absolute path starts from the drive:
C:\Users\asha\demo\photos. It means the same place wherever you run it from.
Windows separates the parts of a path with a backslash.
| You type | You go to |
|---|---|
cd photos | the photos folder inside the current one |
cd .. | the folder above |
cd ..\.. | two levels up |
cd \ | the top of the current drive |
cd ..\old | up one level, then into old |
cd C:\Users | that exact folder |
Pressing Tab after typing the first letters of a name completes it. Pressing Tab again shows the next match. It saves typing and prevents spelling mistakes.
Changing drive
cd does not switch drives by itself. Type the drive letter and a colon to change drive, or add /d to do both at once.
D:
cd /d D:\BackupsNames with spaces
Put the path in double quotation marks.
cd "C:\Program Files"Making folders with mkdir
C:\Users\asha\demo>mkdir reports
C:\Users\asha\demo>mkdir reports\2026\november
C:\Users\asha\demo>dir /ad /b
old
photos
reports
C:\Users\asha\demo>dir /s /b reports
C:\Users\asha\demo\reports\2026
C:\Users\asha\demo\reports\2026\novembermkdir creates any missing folders along the way, so the second command made both 2026 and november. The short form md does the same.
If the folder already exists, the command says so and does nothing.
C:\Users\asha\demo>mkdir photos
A subdirectory or file photos already exists.Removing folders with rmdir
rmdir, or rd, removes an empty folder.
C:\Users\asha\demo>mkdir empty
C:\Users\asha\demo>rmdir empty
C:\Users\asha\demo>rmdir photos
The directory is not empty.The last command was refused: photos has files in it. That refusal is a safety feature.
Danger. rmdir /s foldername removes a folder with everything inside it, including all its subfolders. It asks once, and /q switches even that question off. Nothing goes to the Recycle Bin. Check the name and the current folder twice before using /s, and never run it on a path you typed from memory.
rmdir /s oldpushd and popd
When you need to visit another folder briefly and come back, pushd folder goes there and remembers where you were, and popd returns.
pushd old
popdOpening File Explorer here
start . opens the current folder in a File Explorer window. Going the other way, typing cmd in File Explorer's address bar and pressing Enter opens a Command Prompt in that folder.
Common mistakes
- "The system cannot find the path specified." The folder name is misspelt, or it is not inside the folder you are in. Run
dir /adto see what is there. - Forgetting
/dor the drive letter when the target is on another drive. The prompt stays where it was. - Forward slashes. Many commands accept them, but they are also how switches begin, so backslashes are the safe choice in paths.
On Linux and the Mac, the matching commands are cd, pwd, mkdir and rmdir.
Examples shown with output were run on 12 November 2026 in a practice folder: Windows commands in cmd.exe on Windows 11, Linux commands with the GNU tools of Git Bash. The folder path and user name were replaced with made-up ones. Commands marked "not run here" are shown as you would type them.
This is an independent learning site. It is not connected with Microsoft, Apple or any Linux distribution. Windows, macOS and other names belong to their owners. Try commands first in a practice folder, never on files you cannot afford to lose.