- How to create a directory or folder
- Creating a folder in Microsoft Windows
- My Computer or Windows Explorer
- Windows desktop
- Create a new folder using a shortcut key
- Windows command line
- Creating a directory in MS-DOS and the Windows command line
- Related pages
- Create a directory with a batch file
- Creating a directory in Linux, Unix, and their variants
- Creating a folder and directory in Microsoft Windows 3.X
- File Manager
- Creating a folder in macOS X
- Desktop folder
- Create a folder in a directory
- Все о реестре Regedit / All about registry
- Как создать папку в командной строке? / How create folder in command prompt?
- Create a Folder Using CMD in Windows
- Create a Folder Using CMD in Windows
- Create Multiple Folders Using CMD in Windows
- How to Create and Delete a File or Folder with CMD [MiniTool News]
- Summary :
- How to Create a Folder with CMD
- Step 1. Open Command Prompt
- Step 2. Go to the Folder Location
- Step 3. Create a Folder with CMD
- How to Delete a Folder in Command Prompt
- How to Create a File with CMD
- How to Delete a File in Command Prompt
- How to Recover a Mistakenly Deleted File/Folder
- ABOUT THE AUTHOR
- How To Create Folders/Directories – From The Command Line (The Easy Way!) – Windows, CMD
- Jump Right In:
- Navigating to where we want to create our folder.
- Checking if a folder/directory already exists.
- Create Folder/Directory – From CMD.
- What We’ll Learn:
- Navigating to where we want to create our folder:
- Checking if a folder/directory already exists:
- Create Folder/Directory – From CMD:
- Create folders with spaces within their names:
- Numbered Folders (File1, File2, File3):
How to create a directory or folder
There are multiple ways to create or add a folder, subfolder, directory, and subdirectory on a computer. The methods depend on the operating system or where the directory is being created. Select a link below for steps on how to create a directory and folder in each major operating system.
Creating a folder in Microsoft Windows
My Computer or Windows Explorer
In all versions of Windows, you can also right-click with your mouse on a blank portion of the folder, select New and then Folder.
If you’re using Windows 7 or earlier and do not see the file menu bar at the top of Windows Explorer, press the Alt key and it should become visible.
Create a new folder using a shortcut key
While in Windows Explorer, you can press Ctrl + Shift + N to create a new folder without using the mouse.
Windows command line
See the following MS-DOS and Windows command line user section for information about creating a directory in the Windows command line.
Creating a directory in MS-DOS and the Windows command line
It is more appropriate to use «directory» instead of «folder» when referring to the command line.
To create a directory in MS-DOS or the Windows command line (cmd), use the md or mkdir MS-DOS command. For example, below we are creating a new directory called «hope» in the current directory.
You can also create multiple new directories in the current directory with the md command. In the next example, we are creating three new directories, called «user1,» «user2,» and «user3,» in the current directory.
If you want to create a directory with spaces, you need to surround the directory name with quotes. In the example below, we are creating a directory called «my example directory» in the current directory.
To create a directory in the parent directory, without first moving into that directory, you can use the command below. This example moves back one directory to create the «example» directory.
To create a subdirectory in a different directory without moving it, use a command similar to the example below. This command creates a «test» directory in the hope directory.
Once a directory is created, you can use the cd command to change the directory and move into that directory.
To make a directory in another drive without moving into that drive, use a command similar to the example below. This command creates an «example» directory on the F: drive. The drive letter «f:» can be substituted from any drive letter.
Create a directory with a batch file
A batch file is a series of commands that can be entered in the command line. Therefore, you can use any of the examples from the section above in the batch file to create a new folder.
Creating a directory in Linux, Unix, and their variants
It is more appropriate to use «directory» instead of «folder» when in a command line.
You must have the permissions to create a directory outside of your home directory.
To create a directory in Linux, Unix, or any variant, use the mkdir Linux and Unix command. For example, below we are creating a new directory called hope in the current directory.
Once the directory is created, you can use the cd command to change the directory and move into that directory.
If you want to change the permissions of a directory after its been created, use the chmod command.
Creating a folder and directory in Microsoft Windows 3.X
See the above MS-DOS user section for information about creating a directory in MS-DOS.
Creating a folder in macOS X
Create a folder in a directory
Users may also press the shortcut key combination Command + Shift + N to create a new folder.
To create a directory in the Terminal command line, see the Linux steps.
Все о реестре Regedit / All about registry
Как создать папку в командной строке? / How create folder in command prompt?
Сегодня мы рассмотрим простой пример создания папки в командной строке.
Для создания папки в командной строке:
Зайдите в командную строку, нажав для этого сочетание клавиш Win + R – в окне Выполнить напечатайте cmd и нажмите Enter
Если необходимо перейти в корень диска наберите следующую команду:
Окно с примером как это выглядит в командной строке ниже:
В данном примере рассмотрен переход из папки C:\ Program Files в корень диска C :
Данная команда позволяет выйти из любой папки или папок в корень диска.
Рассмотрим обратный пример перемещения в интересующую нас папку.
CD Имя папки
В данном примере мы перемещаемся из корня диска C : в папку С:\ Program Files
При перемещении в папку, печатая первые буквы названия этой папки, вы можете воспользоваться кнопкой TAB и если папка существует, то система предложит вариант.
Думаю, что будет полезно.
Теперь рассмотрим пример создания папки.
Для создания папки используется команда mkdir
Переместившись в нужный Вам каталог напечатайте:
Mkdir Имя вашей папки
На изображении – создание папки Test на диске C :
Можно создать папку и вложенные в нее папки:
Mkdir » Имя вашей папки\Имя вложенной папки»
На изображении указан пример создания папки 1 на диске C : с двумя вложенными папками 2 и 3
Результат будет выглядеть как на изображении ниже
Также, присутствует возможность создания папки из любой в которой вы находитесь папки без перемещения и навигации по папкам.
Находясь в папке c :\1\2\3 мы создаем папку на диске C : с именем New Test
Справка по команде mkdir можно получить по ключу /?
Starting to master the command line or creation .bat,.cmd files are all interested in fairly simple questions moving from the basics and after a while composing large scripts.
Today, we will look at a simple example of creating a folder on the command line.
To create a folder on the command line:
Go to the command prompt by pressing Win+R in the Run window type cmd and press Enter
Command prompt window.
Attention! When you open a command prompt window, you will see the path C:\Users\You user login
To move through the folders, use the CD command.
If you want to go to the root of the disk, type the following command:
A window with an example of how it looks in the command line below:
In this example the transition from the folder C:\Program Files in the root of drive C:
This command allows you to exit any folder or folders in the root of the disk.
To move to the folder you need to type:
CD folder Name
In this example, we move from the root of the C: drive to the folder C:\Program Files
When moving to a folder, typing the first letters of the folder name, you can use the TAB button and if the folder exists, the system will offer the option.
Just like this. In the article how to create a folder via the command line, we have mastered folder navigation in cmd.
I think it will be useful.
To navigate through the disks in the command line, type the letter of the disk and put a colon after it and press Enter. An example of this transition on the D: drive are shown below:
Now! Let’s look at an example of creating a folder.
To create a folder, use the mkdir command
After moving to the desired directory, type:
mkdir name of your folder
Below is an example:
In this image we are create a Test folder on drive C:
You can create a folder and its subfolders:
mkdir «your folder Name\subfolder Name»
This image shows an example of creating folder 1 on disk C: with two subfolders 2 and 3
The result will look like the image below:
There is also the ability to create a folder from any folder in which you are without moving and navigating through the folders.
Located in the folder С :\1\2\3 we create a folder on the C: drive named New Test
Quotes are required when creating folders with spaces. If there are no quotes, a folder with the first word before the space is created, in our case, New. Try to experiment.
Help for the mkdir command can be obtained with the /? key.
Create a Folder Using CMD in Windows
Not many Windows users are familiar with CMD. The common misconception is that only programmers and computer geeks use CMD. Basically, CMD is a tool that you can use to communicate with your Windows computer. Though the user interface and other input methods are introduced, CMD is one tool that you cannot take for granted. Some commands, such as creating folders, are easier to execute using CMD. You may laugh and think that it is harder to create a folder using CMD instead of using your mouse and the “Right click > New folder” method. You may have a point, but what if you are asked to create 10 folders or more? CMD would greatly simplify the task. Creating a folder using CMD is easy. This article will show you how.
Create a Folder Using CMD in Windows
To use CMD to create a folder on your Windows computer, follow these steps:
Create Multiple Folders Using CMD in Windows
To create multiple folders using CMD, follow these steps:
1. Open CMD on your Windows computer.
2. Go to the directory or folder where you want to create the multiple folders. In this case, we will go to the newly created folder.
3. Type in the MD command, followed by the names of the folders that you want to create. In this case, we want to create four folders named TR1, TR2, TR3 and TR4. Therefore, we input md TR1 TR2 TR3 TR4.
4. The subfolders will be created. You can go to the folder using your computer’s user interface, and you will see that all the subfolders have been created.
5. You are done.
Learning CMD is easy. If you want to know more about using CMD or if you have questions concerning any of the steps above, let us know in the comments section.
How to Create and Delete a File or Folder with CMD [MiniTool News]
By Alisa | Follow | Last Updated December 25, 2019
This tutorial introduces how to create a file or folder/directory with cmd.exe (Command Prompt) on Windows 10. MiniTool software also provides the professional data recovery software to help you recover any deleted/lost files from computer and various storage devices.
If you are wondering how to create a file or folder using Command Prompt, this tutorial provides a detailed guide.
How to Create a Folder with CMD
Step 1. Open Command Prompt
At the beginning, you can press Windows + R to open Run dialog, type cmd in Run, and press Enter to open Command Prompt in Windows 10.
Step 2. Go to the Folder Location
After you enter into Command Prompt, you are at C:\Users\YourName by default. If you want to create a folder in another directory, you can type cd folder path (replace the folder path with the actual folder location), and press Enter to go to the desired directory.
Tip: If the default folder isn’t your target folder and you want to create a file with cmd in anther folder, you should type the whole folder path and hit Enter.
Learn how to hide a folder or file in Windows 10 using CMD. Check how to hide a folder/file or show hidden files Windows 10 with attrib command line.
Step 3. Create a Folder with CMD
Then you can type mkdir folder name (replace folder name with the exact name of the folder you want to create), for instance, mkdir work. After you type the command line, you should press Enter key to run this command to create the folder.
How to Delete a Folder in Command Prompt
Step 1. If you want to delete a folder with CMD, you can follow the same instructions above to enter into Command Prompt and go the directory you want to delete a folder.
Step 2. Then you can type rmdir /s folder name (replace folder name with the exact folder name you’d like to delete), e.g. rmdri /s work. If the folder name has a space between words, you should place the folder name in quotations, e.g. rmdir /s “work 2020”. Finally hit Enter to execute the command, and type “Y” to confirm the action.
How to Create a File with CMD
Step 1. Still, follow the same operation above to open Command Prompt in Windows 10 and go to the folder path in which you want to create a file.
Step 2. Type type nul > filename.fileextension in Command Prompt window and hit Enter, e.g. type nul > work.docx, this will create an empty word file named work.
If you want to create a file with some text in it, you can type echo enter your text here >filename.txt. Replace “enter your text here” with the exact text you want to contain in the file and replace the “filename.txt” with the desired file name and extension. For example, echo How to Create a File with CMD >work.txt.
If you want to create a file with a certain file size in CMD, you can type fsutil file createnew filename.docx 1000, replace filename and 1000 with your preferred file name and file byte size.
Learn how to open a file/folder in Command Prompt (cmd) on Windows 10. Step-by-step guide is included.
How to Delete a File in Command Prompt
Step 1. To delete a file with CMD, you can also open Command Prompt and go to the folder path in Command Prompt.
Step 2. Next you can type dir and press Enter to display all the files in the current folder. Find the file you want to delete.
Step 3. Then you can type del filename.fileextension and press Enter to delete the target file with CMD. You should replace the filename with the exact file name and file extension of the deleting file, e.g. del work.txt. If the file name has spaces, you should put the file name into quotations.
If you receive an error message saying that the file can’t be deleted, you can check: how to force delete a file that cannot be deleted.
Note: Deleting a file/folder using Command Prompt in Windows 10 will permanently delete the file and the deleted file will not go to the Recycle Bin, so please be careful with file deletion with CMD.
How to Recover a Mistakenly Deleted File/Folder
Using CMD to delete a file or folder will permanently delete the file. If you mistakenly delete a file/folder, you can use MiniTool Power Data Recovery – professional free data recovery software for Windows 10/8/7 – to easily recover any deleted/lost files and folder from computer, external hard drive, SSD, USB, SD card, and more in 3 simple steps.
Easy 3 steps to fast recover my files/data for free with best free file recovery software. 23 FAQs and solutions for how to recover my files and lost data are included.
ABOUT THE AUTHOR
Alisa is a professional English editor with 4-year experience. She loves writing and focuses on sharing detailed solutions and thoughts for computer problems, data recovery & backup, digital gadgets, tech news, etc. Through her articles, users can always easily get related problems solved and find what they want. In spare time, she likes basketball, badminton, tennis, cycling, running, and singing. She is very funny and energetic in life, and always brings friends lots of laughs.
How To Create Folders/Directories – From The Command Line (The Easy Way!) – Windows, CMD
Jump Right In:
Navigating to where we want to create our folder.
Checking if a folder/directory already exists.
Create Folder/Directory – From CMD.
What We’ll Learn:
This guide is all about creating new folders or directories from the windows command line.
Navigating to where we want to create our folder:
Before we begin learning how to create folders we must first learn how to change the current working directory, or in other words, the location of our command prompt, into to the location in which we want to create our new folder.
If you want to create your folder in our current directory, simply skip this step.
For this example, let’s assume that we want to create a new directory in your desktop.
1) Open your command line (without administrator privileges)
By default, it should be located at your users directory, usually: “C:\Users\ “. In your case will be your computers username.
2) Use the “ Dir ” command to view every file and folder in the current directory.
From all the files and folders that appear locate the “Desktop” directory.
3) Navigate to the directory of your choice using the “ CD ” command.
“CD” stands for “Change Directory”. Remember to surround the name of the directory you want to navigate into within quotes “”.
And that’s it! You should now have navigated into the directory of your choice.
In case you made a mistake you can navigate one directory backwards by typing Cd followed by two dots.
The double dots represent the parent directory.
Now that we are located in the correct directory lets create our new folder/directory.
Checking if a folder/directory already exists:
Before creating a new directory its always a clever idea to check if a folder with the same name already exists in your target directory. This is especially important with folders that contain files within them, because you might accidentally overwrite all of them and lose important data.
You don’t need to worry however, all we have to do is use a simple if statement that checks whether a folder with a specified name already exists, and prints an appropriate message.
Here is what that would look like:
To make this command work for you replace “My New Folder” with the name of the directory you want to create within quotes.
If you want to learn how it works, lets break it down:
Pretty simple, isn’t it?
Create Folder/Directory – From CMD:
After all that we are finally ready to create a new folder!
Thankfully, doing so is extremely simple. Thanks to the mkdir command, which stands for make directory.
If you’ve ever used the command line before, you might know an alias for this command, “MD”. Both MD and MkDir are exactly the same thing and work in exactly the same way.
Without further a do, lets create our first folder. Here is the command we are going to use:
This command will create a folder named “Cats” in your current directory.
To make the above command work for you change “Cats” with the name of the folder you want to create.
Create folders with spaces within their names:
You might be wondering why we surrounded the name of our new folder within quotes.
Surrounding paths and names in quotes is generally the recommended practice, however in this case they are not strictly necessary.
That’s because, quotes are used to tell the command prompt that spaces separating the names of our folders do not constitute an additional parameter or an additional value and are just a continuation of a name or path.
So, if the name of the folder you want to create contains a space within it, i.e “My Folder”, you need to surround it in quotes. Otherwise, the command prompt might misinterpret your command or display an error.
You can embed the current date right into the name of the folder you are creating by taking advantage of the %Date% automatic variable. As the name suggests, this variable simply stores the current date.
Here is what our command would look like:
This command will create a folder with the current date as the name, in our current directory.
In my case the new directory will be named:
You might be wondering what /=- does. By default, the date in the %Date% variable is stored in this format:
However, to use this as the name of a folder we need to replace the backward slashes with any other symbol, so that the command line doesn’t misinterpret our date as a directory. That is exactly what /=- does, you can replace the dash with any symbol of your choice.
In all the above examples we created only a single folder. However, the beauty of the command line is that you can complete complex, time consuming tasks in only an instance, such as creating multiple directories at once.
Lets take a look at all the ways we can use the command prompt (CMD) to create multiple folders:
Named Folders (First, Second, Third):
Creating named folders or, in other words, multiple folders with different, specified names, is very easy.
This function is built right into the mkdir command. So, all we have to do is type the names of the folders we want to create one after the other.
Here is what that would look like:
The above command will create three folders in your current directory with the following names: First, Second, and Third.
To make this command work for you, simply replace “First” “Second” and “Third” with the names you want your folders to have. The names of the folders do not need to be separated with comas or semicolons, a single space will do just fine!
You can create as many folders you want simply by specifying their names.
The sky is the limit!
To create your folders in a different directory, add the target path just before the name of each folder.
If you are unsure, here’s what that would look like:
Replace with your computers username.
The above command will create a folder named “First Folder” in the desktop directory and a second folder named “Second Folder” in the documents directory!
Numbered Folders (File1, File2, File3):
Apart from crating named folders, we can use the command line to create numbered files or in other words, files for which only a number changes within their names.
To do so, we need to use a For Loop. For loops simply repeat a specified instruction a certain number of times.
Without further a do, here is what our command would look like:
This command will create 10 new folders in our current directory with the following names: Folder (1), Folder (2), Folder (3), and so on…
This command might also look a little complicated, so let’s break it down:
Adjust the above command accordingly to suit your needs.
Once again, if you want to create your new folders in a different directory, add the path of your choice, just before their names.
If you are unsure, here’s what that would look like:
Replace with your computers username.
Finally, if you are planning on running any of these commands from a batch script you need to use two percentage signs instead of one, so that they are interpreted correctly.