DEV Community

Victor James
Victor James

Posted on • Originally published at windowscmd.com on

MD Windows Command

MD

MD

The MD windows command-line tool is for creating a new Directory.

CMD Line

CMD Line is a text-based interface that transfers the command from the user to the OS.

CLI-Command Line Interpreter

The command-line interpreter (CLI) for windows is CMD.EXE. Also, you can use PowerShell which can automize many system administration tasks and these tasks are not approachable in command prompt. With the help of the CLI, you can communicate with your system by typing the text in commands. As a result, your system answers to the text that you have typed previously, and then the user can proceed with the next command line that shows up.

To open the Run command Window

Run command window helps you to run programs, open the files and folders. And there are several ways to open up the run command dialog box. This run command box is useful for you to head straight to the destined program easily.

By using the Keyboard shortcut Key:

WINDOWS+R

One of the most commonly used methods is the Shortcut key method. Also, this method is in all versions of Windows. You need to press the Windows+ R key concurrently to open the Run command dialog box.

Run command box
Run command box

What does the MD command do?

The MD windows command-line tool is for creating a new directory. By using this MD windows command, you can create one or multiple folders or directories. So this command is to make a directory and to create a folder. By default, Command extensions are enabled, which allows a single MD command to create all the intermediate directories in a specified path. MKDIR is the equivalent of MD.

Syntax


 MD [drive:]path [[drive:]path...]

Enter fullscreen mode Exit fullscreen mode

Parameter Explanation

  • path – The path or the directory to create.

The path can be of any characters that are valid up to a maximum path length.

Restrictions

  • If you want to create a Comma , Semicolon ; equals = Space , and so on, you must enclose it with quotation marks.
    • For instance
    • MD “12=23″ will form a folder ’12=23′
    • If you use it without quotation like MD 12=23 the result will be in two folders like ’12’ and ’23’.
  • While scripting, some characters may interrupt, so it is recommended to avoid characters like © ® ” & ‘ ^ @.
  • The limitation of the Windows Explorer of the Maximum length of a full pathname is = 260 characters.
  • Note that the following names cannot be created as a folder CON, PRN, LPT1, LPT2 ..LPT9, COM1, COM2 ..COM9.

Error levels

  • %ERRORLEVEL% = 0 will show up if the Directory was successfully created.
  • %ERRORLEVEL% = 1 will occur if the directory could not be created.

Examples

  • To create a directory named My computer use

 MD Mycomputer

Enter fullscreen mode Exit fullscreen mode
  • To create multiple directories use

C:\temp> MD file1 file2 file 3 

Enter fullscreen mode Exit fullscreen mode
  • This output will be

*C:\temp\file1\

C:\temp\file2\

C:\temp\file3*

  • To create filenames with spaces, use quotation marks l

MD "\myfiles\downloads\text format"

Enter fullscreen mode Exit fullscreen mode

Verdict

In this guide, we have stated the MD windows command-line tool with its syntax and examples. Hope you find this article a useful one. If you have any suggestions or questions regarding this article, let us know in the comment section, we will update it to you shortly.

Related Articles

  • MD The MD windows command-line tool is for creating a new directory. By using this MD windows command, you can create one or multiple folders or directories.
  • MORE The MORE windows command-line tool is for displaying output one screen at a time. The MORE command is an external command.
  • ERASE The Erase command deletes one or more files or file systems. Also, this command is similar to the Del windows command. ERASE is an internal command. ERASE command is equivalent to DEL.
  • ECHO The ECHO windows command-line tool is to display the message on the screen. This command turns the ON/OFF command echoing feature. ECHO is an Internal command.
  • ENDLOCAL The End local command is to end localization of environment changes in a batch file which was modified by the set local command. ENDLOCAL is an internal command.

The post MD appeared first on Windows Commands- SS64 Commands.

Discussion (0)