![]() |
VOOZH | about |
When working with files on Windows, File Explorer usually makes creating and deleting files simple. But what if File Explorer freezes or stops responding? In such cases, the Command Prompt (CMD) offers a reliable alternative. CMD allows you to create and delete files or folders using simple commands, even when File Explorer fails. In this article, we’ll walk you through the commands you need to delete files and folders using Windows Command Prompt. Methods to Delete Files and Folders Using Command Prompt
In the below section you will explore two methods to delete files and folders for Windows using CMD. So go through the methods and choose the right one.
Note: DEL Command is used to delete a file. Here, we will take our sample file "hello.txt" located on the desktop, and try to delete it using the del command in CMD. Follow the steps given below to delete the file:
Step 1: Change the path of the directory in CMD and set it to the path of the file. Type the following command and press Enter.
cd desktopStep 2: Delete the file hello.txt with the following Windows Command.
del hello.txtNote:RMDIR Command is used to delete the entire folder or directory. Here, we will take our sample folder named "Tasks" placed on the desktop and try to delete it using RMDIR Command in CMD.
Step 1: Change the Directory's Path in Command Prompt and set it to the path of the folder.
cd desktopStep 2: Delete the folder Tasks with the following command.
rmdir tasksFrom the above discussion, this should become clear that the Deletion of Windows Files using CMD is a matter of a few seconds. You have to just move inside the Windows Directory using the Windows CD Command. And then, as per your choice execute any one of the Windows File Deletion Commands in CMD.
First open Command Prompt.
Navigate to the directory where the folder you want to delete is located using the cd command.
Command: cd <FolderName>To delete a single folder, use the following command.
Command: rmdir <FolderName>
To delete a folder and all its subfolders and files, just include "/s" in between the rmdir and <folderName>, use the following command and then press Enter.
Command: rmdir /s <FolderName>In this article, we explored how to use Command Prompt in Windows to delete files and folders efficiently when facing issues with File Explorer. We discussed two methods: using the DEL command to delete files and the RMDIR command to delete folders. Additionally, we provided a step-by-step guide on how to delete folders and subfolders using Command Prompt.