windows MD 和 MKDIR 批处理命令有什么区别?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32370254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:15:26  来源:igfitidea点击:

What is the difference between MD and MKDIR batch command?

windowsbatch-filecmddosmkdir

提问by Tomas Kubes

Both command creates folders. I readthat MKDIR can create even subfolders.

这两个命令都会创建文件夹。我读到MKDIR 甚至可以创建子文件夹。

  • Is that only difference?
  • Why there are two commands doing the same?
  • Which one should I use?
  • 仅此而已吗?
  • 为什么有两个命令做同样的事情?
  • 我应该使用哪一种?

回答by aschipfl

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

除了@npocmaka 的回答之外,我还想提供所有此类别名的列表,仅供参考:

cd   =  chdir
md   =  mkdir
rd   =  rmdir
ren  =  rename
del  =  erase

回答by npocmaka

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.