How to Delete a File or Folder using CMD on Windows 10?

You can use the Command Prompt to delete files from your Windows computer if you’re having trouble deleting them using the traditional method. You can use this to delete a variety of files, including photos, videos, and documents.

The Command Prompt has a command you can use to delete those files. You may want to use the Command Prompt method if you are working with extremely large files and deleting them using File Explorer takes all day.

Opening the Command Prompt

You will need to learn how to open the Command Prompt window in Windows 10 first. You can then delete your files and folders using the CMD delete option.

Opening Command Prompt using the Windows Start button

You can also open the Command Prompt by clicking the Start button or by typing its name in the Search field.

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

Step 2. Type in cmd.

Step 3. Select Command Prompt.

Use CMD to Delete Files and Folders
Use CMD to Delete Files and Folders

Opening Command Prompt Using Start Menu

You can also use Windows 10’s Start menu to access the Command Prompt application.

Step 1. Select the Start button.

Step 2. Select the Windows System folder.

Step 3. Choose Command Prompt from the folders given.

Opening Command Prompt Using the Power User Menu

You can also open the Command Prompt by using your keyboard or 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

You need to understand how to navigate the files before you can delete them through cmd delete file or cmd delete folder commands. Do not delete any necessary files.

You need to know how to locate these files before you go ahead and delete them.

Step 1. Please enter the following command along with the username of your computer (C:/Users/MyPC) or in this case (C:/Users/Jessa). You can use this command to display all the files in the selected directory.

dir

Step 2. You can use cd to change the directory of a file in your Desktop folder if it is located there. Your desktop will automatically become the current working directory when you run the following command.

cd “desktop”

You can access your Desktop files from here.

Step 3. The following commands will let you return to the previous directory if you navigated to the wrong directory.

cd.

Deleting Folders Using the CMD Delete Folder Option

You can now use the cmd delete folder option to remove the folders and files you want.

Step 1. Open the Command Prompt window.

Step 2. Type in the following command.

rd /s <folder path>

You can use this command to remove the specified directory. All subfolders and files within the folder will be removed if you specify the /s parameter.

Deleting Files Using the CMD Delete File Option

You can also delete files from the Command Prompt tool.

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

You can delete files and folders using the cmd delete file or cmd delete folder option a bit faster than your normal deleting process; however, it’s not very convenient to type the name of each file or folder you’d like to remove.

You can easily delete all the files and folders within your chosen directory with a single command.

Step 1. Open the Command Prompt.

Step 2. Navigate to your desired folder.

Step 3. Type the following command.

del “File*”

Files that begin with the word “File” are deleted with this command.

You can use this command to remove specific file extensions or types.

del “*.txt”

You can delete every file ending in .txt with this.

Deleting Files or Folders Located in Any Directory

You can use the “Del” command convenient to delete files and folders in the current directory, but there are occasions when you want to delete files and folders from a different directory.

Read Also: FIX: Can’t Run as Administrator on Windows 10

You can delete files from any directory on your computer. On your PC, you can perform that action with the following command.

rmdir “C:\Users\jessa\Documents\My Folder”

When you use the cmd delete file and cmd delete folder, you can clean up your files. You can delete files and folders one by one by typing their names into the corresponding field in this app; you can also select specific file types or folders to be deleted all at once.

Leave a Comment