How to delete file using CMD in Windows?

Deleting a useless or unwanted file on Windows is an easy task. Using command line is one of the effective ways. This passage will will show you how exactly you can use Windows CMD delete file and introduce another two easier ways for file deletion.

Posted by @Hedy December 17, 2024 Updated By @Hedy May 12, 2023

What is delete command in CMD?

CMD, also called Command Prompt, is a Windows application that works as a command-line interpreter, allowing you to manage your disks(including creating/deleting/formatting partition, converting MBR to GPT, etc), troubleshoot Windows issues, solving computer problems, and so on.

If you have trouble deleting files in Windows the regular way, inputting a deletion command line in CMD can delete files very fast. With different deletion commands in Command Prompt, you can delete any files from your computer. Refer to the following text to learn a detailed tutorial on Windows CMD delete file.

How to use command to delete files in Windows?

To help you delete files using Windows command line quickly and successfully, we'll introduce you the commands according to different situations. In the first place, type “cmd” in the search bar, right-click the result and select "Run as Administrator" to open Command Prompt.

Attention: Please note that files deleted by Windows CMD are erased permanently instead of being moved to the Recycle Bin. That is to say, you cannot recover them once the deletion commands are committed. So, think twice before performing Windows delete file CMD.

โ–Œ Use Windows CMD to delete a single file

Deleting a single file is common to see and the command is very simple, just input Del path and press "Enter".

โœ Note: Don't forget the space between Del and path. Make sure you input the right path.

If you want to delete a folder in CMD, replace del with rmdir. For example, input rmdir C:\Users\AOMEI-PC-012\Desktop\work will delete the folder named "work" on the desktop.

โ–Œ Use Windows CMD to delete multiple files

If you plan to delete multiple specific files, you can manually type the file names. Below are the detailed steps:

Step 1. Type cd path to go to where the files to delete are located. For example, if I want to delete several files on the desktop, just input cd C:\Users\AOMEI-PC-012\Desktop(replace the path with your real path) and hit on "Enter" button.

Step 2. Next, type Del filname1 filename2, etc and press "Enter". For instance, there are two txt files named "note" and "on" on the desktop, just input del note.txt on.txt to delete them at once.

โ–Œ Use Windows CMD to delete read-only files

Read-only files are one kind of file that is difficult to make operations like copying, moving, and deleting. If you delete a read-only file in CMD using the above command, you will easily receive an error message saying "Access is denied". In such a case, you need to force delete the file by the command "Del /f path" and press "Enter".

โ–Œ Use Windows CMD to delete junk files

Junk files on the PC are a headache thing for most users. They include temporary files, cache files, log files, and any other useless files. Using the command line is one of the effective ways to remove temp files. Here are the steps:

Step 1. Type %SystemRoot%\explorer.exe %temp%\ and hit "Enter" to view temp files on your computer.

Step 2. Type del %temp%\*.*/s/q and press "Enter" to run the command.

Although you can delete files using Windows command line, it's hard to remember different commands for different deletion tasks. Besides, without the clear GUI interface, it’s easy to delete wrong files and cause some unexpected errors when missing a letter.

To bypass these limits of using Windows CMD delete files, the following part will introduce you an all-in-one file shredder that lets you delete any file clearly and easily. Go ahead to get it.

Advanced tips: Delete files more easily

AOMEI Partition Assistant Standard, a free yet powerful disk manager designed for Windows 11/10/8/7/XP/Vista users, is a popular file deletion tool. Whether you want to delete a single file, multiple files, read-only files, corrupted files, junk files, or delete large files, this utility can help you make it in a quick and safe way.

Download the freeware first and see the steps in detail:

Download FreewareWin 11/10/8.1/8/7/XP
Secure Download

Tip one. Shred files or folders with simple steps

The "Shred Files" feature is specifically used for deleting files or folders you don't need. Once the files or folders are shredded, it’s hard to restore even using the data recovery software. Make sure you really want to delete them permanently. If you haven't made the final decision, you can move the files to a different drive temporarily.

Step 1. Install and open AOMEI Partition Assistant Standard. In the main console, click "Wipe" and select "Shred Files".

Step 2. In the small window, click "Add Files" or "Add Folder" to choose the file or folder you want to delete forcibly.

Step 3. Here you can only choose "Write Zero" as the shredding method.The otherr three shredding ways are only supported in the Professional edition.

Step 4. Click "Shred" button and you will be mentioned a confirmation note, click "Yes".

Tip two. Remove all junk files at one time

As you know from the above content, when you use Windows CMD delete file, only temporary files are gone, while the "PC Cleaner" feature is expert in deleting all kinds of junk files on your computer. It's more useful for solving some store space errors like the appearance of low disk space warning.

Step 1. Open AOMEI Partition Assistant Standard, and then click "Free up" > "PC Cleaner".

Step 2. In the pop-up window, click "Start Scan" to scan for junk files on your PC.

Step 3. Wait until the scanning process completes.

Step 4. After the scan is completed, all kinds of available junk files will be listed. Then, tick the options you want to clean, then click "Clean All" to begin the cleaning process.

Step 5. When you see a correct symbol displayed in the interface, you can click "Back" to exit the Window.

Conclusion

How to use command to delete files in Windows? This passage has covered the different commands for different deletion cases and the relevant steps. If you have a good command of computer, you can certainly perform Windows CMD delete files; if not, a specialized file shredder and PC cleaner should be your top priority.

It’s worth mentioning that AOMEI software is also a disk cloning tool, allowing you to clone the entire hard drive, a single partition, or only OS to another drive without reinstalling OS. Besides, if you are using Windows Servers, you can download the Server edition.