Md and mkdir commands

Updated: 11/12/2023 by Computer Hope
md command

The md and mkdir commands allow users to create directories.

Availability

Md and mkdir are internal commands that are available in the following Microsoft operating systems.

Md and mkdir syntax

Creates a directory.

MKDIR [drive:]path
MD [drive:]path

If Command Extensions are enabled, MKDIR changes as follows:

MKDIR creates any intermediate directories in the path, if needed.
For example, assume \a does not exist then:

mkdir \a\b\c\d

is the same as:

mkdir \a
chdir \a
mkdir b
chdir b
mkdir c
chdir c
mkdir d

which is what you must type if extensions were disabled.

Md and mkdir examples

md test

The example above creates the "test" directory in the current directory.

mkdir "computer hope"

The above command would create a directory called "computer hope." If you want a space in your directory name, it must be surrounded in quotes.

md c:\test

Create the "test" directory in the c:\ directory.

md c:\test1\test2

Create the "test1" directory (if it does not already exist), and then the "test2" subdirectory, in the c:\ directory.