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.

  • How do you create a file using Command Prompt?
  • Which command is used to create a file in DOS?

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.

open Command Prompt

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.

How to Hide/Unhide a Folder/File in Windows 10 with CMD
How to Hide/Unhide a Folder/File in Windows 10 with CMD

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.

Read More

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.

create a folder using CMD

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.

delete a folder in CMD

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.

create a file using CMD

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.

create a file in CMD with text

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.

How to Open a File/Folder in Command Prompt (CMD) Windows 10
How to Open a File/Folder in Command Prompt (CMD) Windows 10

Learn how to open a file/folder in Command Prompt (cmd) on Windows 10. Step-by-step guide is included.

Read More

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.

how to delete a file with CMD

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.

recover files with MiniTool Power Data Recovery

How to Recover My Files/Data for Free in 3 Steps [23 FAQs]
How to Recover My Files/Data for Free in 3 Steps [23 FAQs]

Easy 3 steps to fast recover my files/data for free with best free file recovery software. 23 FAQs for how to recover my files and lost data are included.

Read More
  • linkedin
  • reddit