Skip to content

Batch Script Creating Folders

Learn how to create folders in Windows batch scripts using the md (Make Directory) or mkdir command with examples for basic, recursive, and path-specific directory creation.

Creating Folders

The creation of a folder is done with the md (Make directory) command.

mkdir [drive:]path
md [drive:]path

Examples

Let's look at some examples on how to use the md command.

The following command will create a directory called test in your current directory.

md test

The follow command will create a directory called test in the C drive.

md C:\test

If there are spaces in the folder name, then the folder name should be given in quotes.

md "Test A"

The following command creates directories recursively:

mkdir \a\b\c

and is the same as issuing the following set of commands:

mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
Navigation