How to Use CMD to Delete Files and Folders on Windows 10

If you’re having trouble deleting files from your Windows computer using the traditional delete method, you can use the Command Prompt to delete your files. This helps you delete all types of files including, but not limited to, photos, videos, and documents.

There is a command for the Command Prompt that helps you delete those files. If you are working with really large files and deleting them using File Explorer takes forever, the Command Prompt method to delete files is certainly going to help you out.

Opening the Command Prompt

The first thing that you need to learn is how to open the Command Prompt application in Windows 10. This will then let you use the CMD delete folder and files option to get rid of your files.

Opening Command Prompt using the Windows Start button

One of the ways you can open the Command Prompt is by accessing it through the Windows Start button or Search bar.

Step 1. Select the Start button or access it from the Search bar.


Step 2. Type in cmd.

Step 3. Select Command Prompt.

Opening Command Prompt Using Start Menu

Another way to access the Command Prompt application in Windows 10 is by looking it up manually in the Start menu list.

Step 1. Select the Start button.

Step 2. Select the Windows System folder.

Step 3. Choose Command Prompt from the folders given.

open command prompt

Opening Command Prompt Using the Power User Menu

You also have the option of opening the Command Prompt by just using your keyboard or through the Power User Menu.

Step 1. Press Win + X or right-click the Start button.

Step 2. Choose Command Prompt from the list.

Navigating Your Files Through the CMD Feature

Before you start deleting files through the cmd delete file or cmd delete folder command, it’s important to learn how to navigate the files. You don’t want to delete files that you actually need.

Therefore, before you go ahead and start deleting these files, you should know how to locate them.

Step 1. Along the line of your computer’s username (C:\Users\MyPC) or in this case, it’s (C:\Users\jessa) enter in the following command. This command will show you all the files in the chosen directory.


view directory contents

Step 2. If the file you want to delete is located in your Desktop folder, you can use the cd command to change the directory. Type in the following command to make your desktop the current working directory.

cd "desktop"

navigate to desktop

From here, you will be able to access files that are on your Desktop.

Step 3. If you’ve navigated to the wrong directory, you can return to the previous directory by typing the following.


Deleting Folders Using the CMD Delete Folder Option

Now that you know how to navigate within the Command Prompt environment, you can start using the cmd delete folder option to delete your folders or files.

Step 1. Open the Command Prompt window.

Step 2. Type in the following command.

rd /s <folder path>

This command removes the folder specified folder. The /s parameter will remove all the subfolders and files within the entered folder.

Deleting Files Using the CMD Delete File Option

You can also delete files from the Command Prompt utility.

Step 1. Open the Command Prompt window.

Step 2. Navigate to the location of your desired folder.

Step 3. Use the following command to delete a file.

del /f /a <file path with extension>

The /f is for force delete; /a selects only the specific files.

Deleting Files or Folders All at Once

While deleting files and folders using the cmd delete file and cmd delete folder option is a tad bit faster than the usual deleting process that you’re used to, it’s not exactly easy to type in the name of every file or folder that you want to delete.

Luckily, there is a command that deletes all the files and folders within your chosen directory.

Step 1. Open the Command Prompt.

Step 2. Navigate to your desired folder.

Step 3. Type the following command.

del "File*"

This command deletes every file that begins with the word “File”.

If you want to delete files with specific extensions or file types, you can do this by typing this command.

del "*.txt"

This deletes every file with the .txt extension.

Deleting Files or Folders Located in Any Directory

While you can conveniently use the “Del” command to delete files and folders in the directory you’re in, there will be times when you want to delete files and folders from a different directory.

There is an option to navigate to any directory on your computer and delete the files from there. You can use the following command to do that on your PC.

rmdir "C:\Users\jessa\Documents\My Folder"

Using the cmd delete file and cmd delete folder can really help you out in cleaning your files. Through this, you have the option to delete files and folders one by one by typing in their file names; at the same time, you can also choose to delete specific file types or folders all at once.