Key Takeaways

  • To create a folder with Command Prompt, use the mkdir command followed by the folder name.
  • Mkdir can also be used to create nested folders, multiple folders simultaneously, or a combination of both.
  • If you want to create a file, enter type in Command Prompt, followed by nul > filename.ext, replacing “.ext” with the file type you want.

Whether you’re looking to create a script, make several folders at once, or you simply prefer command-line methods over graphical ones, it’s quick and easy to make folders or files using Command Prompt. We’ll show you how to do it on your Windows 11 or Windows 10 PC.

Before You Begin: Copy the Folder Path and Launch Command Prompt

To use the following methods, you must first copy the path of the folder where you’ll create new folders or files, and then run the Command Prompt utility.

To copy a folder’s full path, launch File Explorer using Windows+E and find your folder. Hold down the Shift key on your keyboard, right-click your folder, and choose “Copy as Path.”

'Copy as Path' highlighted for a folder on a Windows PC.

To open Command Prompt, click the Start button, search for command prompt, then click the relevant result or press Enter. While making folders, if you encounter an error, run Command Prompt as an admin by right-clicking the utility and choosing “Run as Administrator.” Make sure to select “Yes” in the User Account Control prompt.

'Run as Administrator' highlighted for Command Prompt in Start Menu.

After opening Command Prompt, type cd, press Spacebar, paste the folder path you copied by pressing Ctrl+V, and press Enter. This makes your chosen folder the current working directory in the tool. Each command you run will perform the specified action in this directory.

'cd' command typed in Command Prompt.

Create a Single Folder

To make a single folder, type the following command, replacing “FolderName” with the name you want to assign to your folder. Then, press Enter.

mkdir FolderName

For example, to make a folder named “Mahesh”, use the following command:

mkdir Mahesh
Create a single folder from Command Prompt.

To create a folder that has spaces in its name, enclose the name with double quotes like this:

mkdir “Mahesh Makvana”

Create a Folder Inside Another Folder (Subfolder)

One way to make a folder inside another folder is to make that other folder the current working directory. To do that, type cd, press Spacebar, enter the name of the folder in which you want to create a new folder, and press Enter. Then, type the following command, replace “MyFolder” with the name you want to give to your new folder, and press Enter.

mkdir MyFolder

Another way to create a folder inside a folder is to specify the other folder right in the mkdir command itself. For example, if you have a subfolder named “Photos” and you want to create a new folder named “Personal” inside it, use the following command:

mkdir PhotosPersonal
Create a subfolder using Command Prompt.

Create Multiple Folders at Once

To make several folders at once, add the required folder names to the mkdir command.

For example, to create three separate folders named Documents, Photos, and Videos, use the following command:

mkdir Documents Photos Videos
Create multiple folders with Command Prompt.

Make sure to enclose the folder name with double quotes if its name has spaces.

Create a File with Command Prompt

Command Prompt allows you to create empty files, which you can then use with appropriate apps. The syntax for creating a new file is as follows:

type nul > name.ext

Here, “name” is the name of the file you want to create and “ext” is the extension of the file.

For example, to make a text file named document.txt, you’ll use the following command:

type nul > document.txt
Create a file with Command Prompt.

To create a text file and add some actual text to it, use the following command. Replace “Welcome to How-To Geek” with the text you want to add and “howtogeek” with the name you want to use for the file.

echo Welcome to How-To Geek > howtogeek.txt

When you open howtogeek.txt in a text editor you’ll find it has “Welcome to How-To Geek” written in it.

And that’s how you make folders and files without using graphical tools on your Windows machine.