TechJunkie is a BOX20 Media Company

Home PC Windows Create Folder CMD Example

Create Folder CMD Example

Create Folder CMD Example

You can make folders on your computer in many different ways; it all depends on the type of operating system it is running. In Microsoft Windows, you can create folders using Windows Explorer or even from your desktop. There are even shortcuts for creating folders, which are very useful and save time.

Did you know that you can create folders using the Windows command line? You can even make subfolders this way, and it is pretty easy. Keep reading and you will learn many useful tricks for using the command line to create folders.

Create Folders from the Command Line

People who are tech-savvy are going to correct you straight away and tell you that you make directories and not folders in the command line. They are essentially the same thing, but the command for making directories is actually called “mkdir” and allows you to make directories and subdirectories.

In this article, you will get to take a look at the syntaxes for many commands that can make your life easier when making directories in the command line. All of them will have thorough explanations. Both mkdir and md MS-DOS commands can be used to make directories.

To get started, you need to open the Command Prompt. In Windows 7, 8, and 10, you just have to click the Windows (Start) button in the bottom-left corner of the screen, type “cmd” into the search box, and hit Enter on your keyboard. In older versions of Windows, you need to click on Start, then select Run, and then type either “cmd” or “command” before hitting Enter.

Once you’ve done that, go ahead and create a folder in the current directory and name it as you please. For example, ours is “light,” and we created it using the following command:

mkdir light

create folder

Current Directory

When you are using the Windows command line, the current directory is shown as a prompt. This prompt can be “C:\\Users\User.” In that case, the current directory is “User,” “Users” is the parent directory, and “C” is the root directory. If you want to list the files in your current directory, use the command “dir,” and in case you would like to change it, use the command “cd.”

Create Multiple Folders Using Command Line

You can also create multiple new folders in the current directory with the command line. There are even different commands for it. Here is the first example for making three new folders with the md command. They will be named folder1, folder2, and folder3.

md folder1 folder2 folder3

In case you want your folder to have spaces in the name – for example, “folder for my stuff” – you will need to use quotes. Here is how the command should look like:

md “folder for my stuff”

You can also make a folder in the previously mentioned parent directory (the directory that precedes the current directory). With this command, you will move back to the previous directory and create the “folder” directory:

md ..\folder

You can also make a subfolder in a different folder without even moving to it. In the following example, we made a “bright” subfolder in the “light” folder.

mkdir light\bright

Make a Folder Hierarchy

When you create multiple folders using the command line, you can actually make them follow a hierarchy. So, you will have a main folder and subfolders as the end result. Additionally, you will only be using one command to do it.

Here is an example command, which made a new main directory called “directory1,” with a subdirectory “directory2” and a sub-subdirectory “directory3”:

mkdir directory1\directory2\directory3

You can achieve the same result by using three separate commands in a sequence, although the first example is much easier and it saves you some time.

mkdir directory1

mkdir directory1\directory2

mkdir directory1\directory2\directory3

bash

Create a Folder in a Different Drive

You can even make a folder in a different drive using the command line, without even moving to that drive. Here, the command made a “test” folder on the D: drive. You can change the drive letter to any other drive you prefer.

md d:\test

Issues Which You May Encounter

First of all, you need to have permission to make these folders. Otherwise, the commands won’t work. You will get the following “Access is denied” message if you attempt to make a folder without permission:

“C:\Users>mkdir c:\users\user\example

Access is denied”

Also, you will get an error in case you are trying to create a folder with an already existing folder name. It will look like this:

“C:\md example

A subdirectory or file example already exists”

In case you get this error but can’t find the folder with that name, enable “show hidden folders” to check if it was hidden. In Windows 10, just start typing “show hidden files and folders” in the start menu and it will be the first search result.

In case you get an error saying the command syntax is incorrect, you need to ensure you are using the right format. In Windows, the directory paths are separated by “\” (a backslash) and in Linux, they are separated by “/” (a forward slash). The error will look like this:

“C:\>mkdir directory1/directory2

The syntax of the command is incorrect”

This will be fixed if you use this command instead:

C:\>mkdir directory1\directory2

New Folder

On a Windows operating system, right-clicking anywhere on the desktop or any other directory will let you create a new folder with New > Folder. You can even create a folder using file explorer by clicking on “New folder” in the center of the menu.

There are plenty of options when creating folders, you just have to find out which one suits you best. Now you are equipped with the tools to make even multiple folders using the command line, so go ahead, and have fun.

Have these examples helped you create folders from the command line? Which method for creating folders do you prefer? Let us know in the comments below.

How To Block Followers on Strava

Read Next 

Leave a Reply

Your email address will not be published. Required fields are marked *


Anna Middleton

Jul 9, 2019

283 Articles Published

More