How to Create a Folder in Command Prompt (mkdir Guide for Windows)

Creating folders from the Command Prompt is faster than clicking through File Explorer when you need several folders at once, a nested folder structure, or a folder created by a batch script. The command is mkdir, also written md. This guide covers the basic command, folders with spaces, creating several folders or a whole path in one line, making folders somewhere else on your PC, and fixing the common errors. Everything here works the same in Windows 10 and Windows 11.

Quick Answer

Open Command Prompt, go to the location with cd, and type mkdir FolderName, then press Enter. If the name contains spaces, put it in quotes: mkdir "Project Files". To create a folder somewhere else, give the full path: mkdir "C:\Users\YourName\Desktop\New Folder".

Command Prompt window showing the mkdir command creating a folder and the dir command listing it
The mkdir command (1) creates the folder, and dir lists it (2) to confirm it exists.

Step 1: Open Command Prompt

  • Press Windows key + R, type cmd, and press Enter.
  • Or open Start, type cmd, and click Command Prompt.
  • In File Explorer, click the address bar, type cmd, and press Enter. Command Prompt opens already in that folder.

Command Prompt starts in your user folder, for example C:\Users\YourName.

Step 2: Go to Where You Want the Folder

Command What it does
cd Documents Moves into the Documents folder inside the current folder
cd .. Moves up one level
cd /d D:\Backups Switches to a different drive and folder in one step
cd %userprofile%\Desktop Goes to your Desktop
dir /ad Lists only the folders in the current location

Step 3: Create the Folder

mkdir Reports

Press Enter. Nothing is displayed if the command succeeds. Type dir to confirm the folder is there. md Reports does exactly the same thing.

More Useful mkdir Examples

Goal Command
Folder name with spaces mkdir "Tax Returns 2025"
Several folders at once mkdir Photos Videos Music
Nested folders in one step mkdir Clients\Acme\Invoices
Folder at a full path mkdir "D:\Archive\Old Projects"
Folder on your Desktop from anywhere mkdir "%userprofile%\Desktop\Scans"
Month folders for a year for %m in (01 02 03 04 05 06 07 08 09 10 11 12) do mkdir 2026-%m

Nested creation works because command extensions are on by default. Windows creates any missing parent folders along the way. In a batch file (.bat), write %%m instead of %m in the for loop.

Create a Folder in PowerShell or Windows Terminal

If you use PowerShell instead, mkdir "Project Files" also works. The native command is:

New-Item -ItemType Directory -Path "C:\Users\YourName\Documents\Project Files"

In PowerShell, mkdir Photos Videos does not create two folders. Separate names with commas instead: mkdir Photos, Videos.

Common Errors and Fixes

“A subdirectory or file … already exists.”

A folder or file with that name is already in this location. Pick another name or check with dir. In scripts, avoid the error with if not exist "Reports" mkdir "Reports".

“Access is denied.”

You are trying to create a folder in a protected location such as C:\, C:\Windows, or C:\Program Files. Choose a folder in your user profile, or open Command Prompt as administrator. To do that, search for cmd, right-click it, and choose Run as administrator.

“The syntax of the command is incorrect.”

The name contains a character Windows does not allow in folder names (\ / : * ? " < > |), or quotes are unbalanced.

Two folders were created instead of one

You left spaces in the name without quotes, so mkdir My Folder created “My” and “Folder.” Delete them with rmdir My Folder and try again with quotes.

The folder is not where I expected

Command Prompt creates it in the current directory shown before the >. Run cd by itself to see where you are.

Open, Rename, or Remove the Folder

  • Open it in File Explorer: start "" "Project Files", or explorer . to open the current folder.
  • Rename it: ren "Project Files" "Client Projects"
  • Delete an empty folder: rmdir "Project Files"
  • Delete a folder and everything in it: rmdir /s "Project Files". This deletes permanently and skips the Recycle Bin, so double-check the name.

Related: Change directories in Command Prompt.

Frequently Asked Questions

What is the difference between md and mkdir?

None. They are two names for the same command.

Can I create a folder on another drive?

Yes. Include the drive letter in the path, such as mkdir "E:\Photos", or switch drives first with cd /d E:\.

Does mkdir work in Windows 11?

Yes. The same commands work in Windows 10 and 11, in both Command Prompt and Windows Terminal.

How do I create a hidden folder?

Create it, then run attrib +h "FolderName". This hides it from normal view but does not secure it.

Summary

  1. Open Command Prompt (Win + R, cmd).
  2. Use cd to go to the right place, or plan to use a full path.
  3. Run mkdir FolderName, with quotes around names that have spaces.
  4. Create several folders or a nested path in one command.
  5. Confirm with dir.