SoFunction
Updated on 2025-03-10

dos create folder md

If the folder you want to create has spaces or &, you need to enclose the folder name in quotes, for example: md "test abc", md "abc&xyz". What are the consequences if quotes are not used?

The results of the test are:

1. If the folder name has spaces, then the md test abc statement will create two folders test and abc in the current directory; using this feature, we can sometimes receive the miracle effect of simplifying the traditional: if you want to create the three folders abc def xyz, just use md abc def xyz directly, without writing three md statements in a row. Of course, the writing method of md abc;def;xyz or md abc,def,xyz is also possible.
2. If the folder name contains &, then md abc&xyz will create the abc folder and prompt: 'xyz' is not an internal or external command, nor is it a runnable program or batch file. This is because & is the connection symbol of the compound statement, which treats the first and the last parts as two sub-statements.

Advice: If the folder name contains special symbols, don't forget to use double quotes!

md also has a relatively convenient function: create intermediate directories. In other words, a command like md a\b\c can create folder a in the current directory, then create folder b under a, and then create folder c under b, and complete it in one go, without first md a, then cd a, then md b, then cd b, then cd b, and then md c.