How to Create a Folder or File from Windows Command Prompt

Atish is a seasoned tech enthusiast fueled by caffeine and a Computer Science engineering degree. He stumbled into the blogging world in 2015 and hasn’t looked back. Over 2000+ articles later, his work has been featured on sites like Gizbot, Firstpost, PhoneArena, GSMArena, and IBTimes. At GT, he’s your go-to guy for how-tos, invaluable tips, and troubleshooting guides that actually work. He’s also an SEO and digital marketing whiz and content strategist, so his tech takes are always on point and ethical.

How to Create Folders From CMD in Windows

Create a Single Folder

Step 1: Press theWindows keyon your keyboard, typeCommand Prompt, and clickOpen.

Step 2: Now, it is time to select the destination where you want to create a new folder. Type the below command and hitEnter.

Note: In place of YourDirectoryPath below, enter your specified destination path. For example, if you want to create a folder on the Desktop,type cd desktopand press Enter.

If you change your mind and want the directory to be changed, type the drive name with the colon (:) symbol (example- D:) and hit Enter.

Step 3: Once you have reached the desired destination, type the below command and pressEnter.

Note: Replace NameofYourDirectory with the folder’s name (for example- Games or Personal Files or Movies, etc.)

That’s it. You have successfully created a single folder on your Windows computer using Command Prompt. If you are looking to create multiple folders or subfolders, continue reading.

Create Multiple Folders or Subfolders

We will demonstrate how to create three folders at the same time.

Step 1: Press theWindows keyon your keyboard, typeCommand Prompt, and clickOpen.

Step 2: Now, it is time to select the destination where you want to create a new folder. Type the below command and hitEnter.

Note: In place of YourDirectoryPath below, enter your specified destination path. For example, if you want to create a folder on the Desktop,type cd desktopand press Enter.

If you change your mind and want the directory to be changed, type the drive name with the colon (:) symbol (example- D:) and hit Enter.

Step 3: Once you have reached the desired destination, type the below command and pressEnter.

Note: Replace NameofYourDirectory with the name of the folder. For example, it can be Games, Document, and Movies. Ensure you keep a gap between the folder (directory) names.

There you go. You have successfully created a folder using the Windows Command Prompt. Continue with the steps below to create a subdirectory using CMD.

Step 4: You know the name of the folders you created. First, you must choose the folder you want subfolders in, type the below command, and hitEnter.

Step 5: In the directory where you want to create subfolders, type the following command and pressEnter.

Note:You can have multiple subfolders in a single folder. However, be sure to leave a gap between the folder name (directory).

There you have it. The subfolders are created under the folder you want. You can repeat the above steps to create multiple subfolders in multiple folders.

Keep reading if you want to take it further and create a file in cmd.

How to Create a File Using CMD in Windows

Create an Empty File

Step 1: Press theWindows keyon your keyboard, typeCommand Prompt, and clickOpen.

Step 2: Now, it is time to select the destination where you want to create a new folder. Type the below command and hitEnter.

Note: In place of YourDirectoryPath below, enter your specified destination path. For example, if you want to create a folder on the Desktop,type cd desktopand press Enter.

Step 3: Now that you are in the destination directory, type the below command and pressEnter.

Note: Replace the filename with the name you want, and ‘.FileExtensions’ should be set to the file extension, such as .txt, .docx, etc.

That’s about it. An empty file will be created with the set extension for you to check and work on later. If you want to make a file containing some text using cmd, continue reading.

Create a File Containing Some Text

Step 1: Press theWindows keyon your keyboard, typeCommand Prompt, and clickOpen.

Step 2: Now, it is time to select the destination where you want to create a new folder. Type the below command and hitEnter.

Note: In place of YourDirectoryPath below, enter your specified destination path. For example, if you want to create a folder on the Desktop,type cd desktopand press Enter.

Step 3: Now, in the destination directory, type the below command and pressEnter.

Note: Replace the filename with the name you want, and ‘.FileExtensions’ should be set to the file extension, such as .txt, .docx, etc.

Step 4: Type the text you want to put in the file. If you are entering multiple lines, use the Enter key.

Example: This is a test writeup to test the method and create a file with content using Command Prompt.

Step 5: PressCtrl + Zon your keyboard once you add text to the file and hitEnter.

With this, a new file will be created with the entered details, which you can access via File Explorer and edit further if required. If, for some reason, you are unable to execute the command, reach out toMicrosoft Supportand get the issue resolved.

If there is anything we have missed in the article, please refer to the FAQ section below.

FAQs on Create and Delete a Folder Command Prompt

To delete a folder and its contents, use the “rmdir” (remove directory) command followed by the folder path. For example: rmdir /s /q C:\Users\YourUsername\Desktop\OldFolder

Both “rmdir” and “rd” are used to remove directories. “rmdir” is the full command, while “rd” is a shorthand version of it. You can use either command interchangeably.

Once a folder is deleted using Command Prompt, it typically goes to the Recycle Bin, where you can restore it. If you’ve emptied the Recycle Bin, data recovery software may be necessary to attempt recovery.

Now that you know how to create a folder or file using Windows Command Prompt, you can quickly automate tasks, manage remote systems, create files, or enhance your command-line proficiency.

Was this helpful?

Last updated on 17 August, 2024

Leave a ReplyCancel reply

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

Name*

Email*

Comment*

Δ

The article above may contain affiliate links which help support Guiding Tech. The content remains unbiased and authentic and will never affect our editorial integrity.

More in Windows

How to Update Windows 10 Offline Easily

6 Ways to Fix Xbox App Not Opening in Windows 11

JOIN THE NEWSLETTER

Get Guiding Tech articles delivered to your inbox.

© 2024 Guiding Tech Media. All Rights Reserved.