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.

  • Availability

  • Md and mkdir syntax

  • Md and mkdir examples

  • All Versions of MS-DOS

  • Windows 95

  • Windows 98

  • Windows ME

  • Windows NT

  • Windows 2000

  • Windows XP

  • Windows Vista

  • Windows 7

  • Windows 8

  • Windows 10

  • Windows 11

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 would have to 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.

  • See our directory definition for further information and related links on this term.