DEV Community

Cover image for Windows MKDIR Command: Create Folders Fast From CMD
arnostorg
arnostorg

Posted on

Windows MKDIR Command: Create Folders Fast From CMD

The Windows MKDIR command (short alias: md) creates new folders from Command Prompt. When you are already in a terminal — scripting, fixing a project layout, or setting up a deploy tree — it is faster than opening File Explorer and clicking New Folder.

This guide covers the basics, nested paths, useful patterns, and common mistakes. For the official reference, see Microsoft Learn’s mkdir command.

What does MKDIR do?

mkdir projects
Enter fullscreen mode Exit fullscreen mode

That creates a folder named projects in the current directory. The short form does the same thing:

md projects
Enter fullscreen mode Exit fullscreen mode

mkdir and md are interchangeable in CMD.

Create nested folders in one shot

On modern Windows, mkdir creates missing parents automatically:

mkdir projects\cli-tools\scripts
Enter fullscreen mode Exit fullscreen mode

You get projects, then cli-tools inside it, then scripts — without three separate commands.

If any segment already exists, CMD reuses it and only creates what is missing. That makes nested creates safe to re-run.

Multiple folders at once

Space-separated names create siblings in the current directory:

mkdir docs src tests
Enter fullscreen mode Exit fullscreen mode

Three folders appear side by side: docs, src, and tests.

Quoted names work when a folder name has spaces:

mkdir "My Notes" "Raw Data"
Enter fullscreen mode Exit fullscreen mode

Useful workflows

Scaffold a small project tree

mkdir app\src app\tests app\docs
Enter fullscreen mode Exit fullscreen mode

Create a dated backup folder

mkdir backups\2026-09-11
Enter fullscreen mode Exit fullscreen mode

Jump in immediately after creating

mkdir reports && cd reports
Enter fullscreen mode Exit fullscreen mode

&& runs cd only if mkdir succeeds.

MKDIR vs File Explorer

Need Why MKDIR helps
Nested path One command builds the whole tree
Scripts / automation Repeatable folder layout in a .bat file
Already in a prompt No context switch to Explorer
Exact names No accidental typos from clicking Rename

Common mistakes

Path not found (older expectation)

People coming from older docs sometimes expect parents to fail. On current Windows CMD, nested mkdir usually just works. If you still hit a path error, check that the drive/root exists and that you have write permission.

Creating in the wrong place

mkdir always creates relative to the current directory unless you pass a full path:

mkdir C:\Users\Public\scratch
Enter fullscreen mode Exit fullscreen mode

Confirm where you are first:

cd
Enter fullscreen mode Exit fullscreen mode

Name already exists as a file

If notes is a file, mkdir notes fails. Rename or move the file, then retry.

Quick reference

Goal Command
One folder mkdir projects
Short alias md projects
Nested path mkdir a\b\c
Several siblings mkdir docs src tests
Name with spaces mkdir "My Notes"
Create then enter mkdir reports && cd reports

Practice MKDIR hands-on

Typing the command a few times sticks better than reading about it.

CMD Master is a free online interactive learning platform for the command line. Practice Windows CMD, PowerShell, and Bash in a live browser terminal with instant feedback — no install and no VM. Most lessons are free. For a structured Windows path that covers core commands like MKDIR, start the interactive Windows Command Prompt course.

Tip: run mkdir /? in a real prompt once, then practice nested creates until muscle memory takes over.

Top comments (0)