You are viewing the article How to Create and Delete Files or Folders from Windows Command Prompt at Thptlaihoa.edu.vn you can quickly access the necessary information in the table of contents of the article below.
The Windows Command Prompt is a powerful tool that allows users to interact with their computers through text-based commands. While the graphical user interface provides an intuitive way to create and delete files and folders, the Command Prompt offers a more efficient and precise method for accomplishing these tasks. In this guide, we will explore how to create and delete files or folders using the Command Prompt in Windows. Whether you are a tech enthusiast or simply want to enhance your computer skills, this tutorial will equip you with the knowledge and techniques to effectively manage your files and folders through the Command Prompt.
This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.
The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.
This article has been viewed 41,397 times.
This is an article that shows you how to use Command Prompt on Windows to create and delete files and folders (also known as directories). Files that you create from the Command Prompt can be edited and managed using Windows applications, including File Manager and text editors.
Steps
Create folder
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 1](https://www.wikihow.com/images_en/thumb/c/c6/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-1-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-1-Version-2.jpg)
- Right-click the Start menu and select Command Prompt .
- Press ⊞ Win + S to open the search bar, type cmd , and then click Command Prompt in the search results.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 2](https://www.wikihow.com/images_en/thumb/9/91/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg)
- For example, if you wanted to create a folder on the Desktop, you would type cd desktop and press ↵ Enter .
- If the directory is not in the user directory (such as C:Users Your Name ), you will have to enter the path (e.g. C:UsersNameDesktopFiles ).
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 3](https://www.wikihow.com/images_en/thumb/4/4e/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-3-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-3-Version-2.jpg)
- For example, to create a folder named “Homework”, you would type mkdir Homework .
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 4](https://www.wikihow.com/images_en/thumb/4/49/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-4-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-4-Version-2.jpg)
Delete folder
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 1](https://www.wikihow.com/images_en/thumb/c/c6/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-1-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-1-Version-2.jpg)
- Right-click the Start menu and select Command Prompt .
- Press ⊞ Win + S to open the search bar, type cmd and click Command Prompt in the search results.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 2](https://www.wikihow.com/images_en/thumb/9/91/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg)
- For example, if you want to delete a folder from the Desktop, type cd desktop .
- If the directory is not in the user directory (such as C:Users Your Name ), you will have to enter the entire path (e.g. C:UsersNameDesktopFiles ).
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 12](https://www.wikihow.com/images_en/thumb/b/b4/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-12-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-12-Version-2.jpg)
- For example, if you wanted to delete the “Homework” directory, you would enter rmdir /s Homework here.
- If the folder name contains spaces (such as “Homework assignments”), enclose the name in quotes (e.g. rmdir /s "Homework assignments" ).
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 13](https://www.wikihow.com/images_en/thumb/d/d3/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-13.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-13.jpg)
- If you want to delete a folder that contains hidden files or folders, you will see the error message “The directory is not empty”. In this case, you will have to remove the “hidden” and “system” attributes of the files inside the directory. Do the following: [2] XResearch Sources
- Use cd to change to the directory you want to delete.
- Execute the command dir /a to see a list of all files in the directory and their properties.
- If you still cannot delete all files in the directory, execute the command attrib -hs * . This is a special access removal operation from files that cannot be deleted.
- Type cd .. and press ↵ Enter to return to the previous directory.
- Execute the command rmdir /s again to delete the directory.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 14](https://www.wikihow.com/images_en/thumb/8/8f/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-14.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-14.jpg)
Create file
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 5](https://www.wikihow.com/images_en/thumb/d/da/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-5-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-5-Version-2.jpg)
- Right-click the Start menu and select Command Prompt .
- Press ⊞ Win + S to open the search bar, type cmd and then click Command Prompt in the search results.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 2](https://www.wikihow.com/images_en/thumb/9/91/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg)
- For example, if you want to create a file on the Desktop, type cd desktop and press ↵ Enter .
- If the directory is not in the user directory (such as C:Users Your Name ), you will have to enter the entire path (e.g. C:UsersNameDesktopFiles ).
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 8](https://www.wikihow.com/images_en/thumb/a/a7/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-8-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-8-Version-2.jpg)
- Type type nul > filename.txt .
- Replace filename.txt with the filename and extension you like. Other common extensions include “.docx” (Word document), “.png” (empty image file), “.xlsx” (Excel document), and “.rtf” (for text) basic format).
- Press ↵ Enter .
- Type copy con testfile .txt , but replace testfile with the filename you like.
- Press ↵ Enter .
- Enter the content you like. This is a rudimentary text editor, but still effective for coding or taking quick notes. You can use the Enter key while editing to enter text on the next line if you like.
- Press Ctrl + Z when you are done editing the file. This is the operation to save all the content entered into the file.
- Another way to do this is to enter the echo command here > filename .txt .
- fsutil file createnew filename .txt 1000 .
- Replace filename with the name you want, and replace 1000 with the number of bytes to create for the file.
Delete files
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 5](https://www.wikihow.com/images_en/thumb/d/da/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-5-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-5-Version-2.jpg)
- Right-click the Start menu and select Command Prompt .
- Press ⊞ Win + S to open the search bar, type cmd and then click Command Prompt in the search results.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 2](https://www.wikihow.com/images_en/thumb/9/91/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-2-Version-2.jpg)
- For example, if you want to create a file on the Desktop, type cd desktop and press ↵ Enter .
- If the directory is not in the user directory (such as C:Users Your Name ), you will have to enter the entire path (e.g. C:UsersNameDesktopFiles ).
- Files deleted using Command Prompt will be permanently deleted instead of being moved to the Recycle Bin. Therefore, you should be very careful when deleting files using Command Prompt.
![Image titled Create and Delete Files and Directories from Windows Command Prompt Step 17](https://www.wikihow.com/images_en/thumb/4/42/Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-17.jpg/v4-728px-Create-and-Delete-Files-and-Directories-from-Windows-Command-Prompt-Step-17.jpg)
- For example, to delete a text file named “hello”, you would type del hello.txt into the Command Prompt.
- If the filename has spaces (eg “hi there”), enclose the filename in quotes (such as del "hi there" ).
- If you get a message that the file cannot be deleted, use the command del /f filename instead , as this command is used to delete read-only files.
Warning
- Files deleted using Command Prompt will be permanently deleted instead of being moved to the Recycle Bin. Therefore, you should be very careful when deleting files using Command Prompt.
This article is co-authored by a team of editors and trained researchers who confirm the accuracy and completeness of the article.
The wikiHow Content Management team carefully monitors the work of editors to ensure that every article is up to a high standard of quality.
This article has been viewed 41,397 times.
This is an article that shows you how to use Command Prompt on Windows to create and delete files and folders (also known as directories). Files that you create from the Command Prompt can be edited and managed using Windows applications, including File Manager and text editors.
In conclusion, the Windows Command Prompt provides a simple and efficient way to create and delete files or folders. By utilizing a few basic commands such as “mkdir” to create a folder or “del” to delete a file, users can easily manage their file system without the need for a graphical user interface. Additionally, the Command Prompt offers various options to customize file or folder creation and deletion, such as specifying file extensions, recursively deleting contents within a folder, or confirming deletion prompts. While it may take some time to familiarize oneself with the commands and parameters, mastering these skills can greatly enhance productivity and streamline file management tasks in a Windows environment. Whether managing personal or professional files, understanding how to create and delete files or folders from the Command Prompt is a valuable skill for any Windows user.
Thank you for reading this post How to Create and Delete Files or Folders from Windows Command Prompt at Thptlaihoa.edu.vn You can comment, see more related articles below and hope to help you with interesting information.
Related Search:
1. How to create a file using the Windows Command Prompt
2. Steps to create a folder from the Command Prompt in Windows
3. Creating and naming a file with specific extensions using Command Prompt
4. Deleting a file using the Windows Command Prompt
5. Deleting an empty folder using Command Prompt in Windows
6. How to delete a folder and its contents using Command Prompt
7. Renaming a file using the Command Prompt in Windows
8. Moving a file to a different directory using Command Prompt
9. Copying a file from one folder to another using the Windows Command Prompt
10. Finding and viewing files within a folder using the Command Prompt in Windows