What is the difference between MD and MKDIR batch command?
Asked Answered
A

4

20

Both command creates folders. I read that MKDIR can create even subfolders.

  • Is that only difference?
  • Why there are two commands doing the same?
  • Which one should I use?
Angy answered 3/9, 2015 at 8:8 Comment(1)
Both are same. One (md) is shortcut.Rastus
P
29

Just aliases of the same command.Here are the help messages:

C:\>md /?
Creates a directory.

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

and

C:\>mkdir /?
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.
Photophilous answered 3/9, 2015 at 8:10 Comment(0)
E
33

In addition to @npocmaka's answer, I want to provide a list of all such aliases, just for reference:

cd   =  chdir
md   =  mkdir
rd   =  rmdir
ren  =  rename
del  =  erase
Elissa answered 3/9, 2015 at 9:55 Comment(0)
P
29

Just aliases of the same command.Here are the help messages:

C:\>md /?
Creates a directory.

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

and

C:\>mkdir /?
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.
Photophilous answered 3/9, 2015 at 8:10 Comment(0)
A
2

On Linux/Unix/MacOS, mkdir is very similar, but md means nothing. If you want something cross-platform, you should use mkdir.

Aboutship answered 10/12, 2020 at 6:43 Comment(0)
R
1

For Question 01

Literally, md and mkdir commands are the same in their functionality. Microsoft Learn web page says this.

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/mkdir

Both md and mkdir are able to create subfolders without using any cd command.

For example;

mkdir a\b\c acts the same as md a\b\c if b and c directories don't exist inside a directory. It will create 'a' directory then go inside it and create 'b' directory then go inside it and create 'c' directory. If all of a,b, and c do exist, will print an error.

For Question 02

Actually, I have no idea dude!

For Question 03

If you are expecting a cross-platform experience, you better use mkdir command.

Rubio answered 28/12, 2022 at 16:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.