Software & Apps > Windows 48 48 people found this article helpful Del Command Examples, options, switches, and more By Tim Fisher Tim Fisher Facebook Twitter Senior Vice President & Group General Manager, Tech & Sustainability Emporia State University Tim Fisher has more than 30 years' of professional technology experience. He's been writing about tech for more than two decades and serves as the SVP and General Manager of Lifewire. lifewire's editorial guidelines Updated on September 11, 2020 Tweet Share Email Tweet Share Email In This Article Expand Jump to a Section Availability Syntax Examples Related Commands The del command is a Command Prompt command used to delete files. Various command options are available so that you can remove files that have a certain file extension, delete every file in a folder, get rid of only the files with certain file attributes, and more. Unlike deleting files normally, data removed with the del command doesn't end up in Recycle Bin. This command is the exact same as the erase command. Del Command Availability The del command is available from within the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP operating systems. It can also be used in Command Prompt in the Advanced Startup Options and System Recovery Options repair/recovery menus. In Recovery Console in Windows XP and Windows 2000, the delete Recovery Console command can be used instead. Del Command Syntax del [/p] [/f] [/s] [/q] [/a[:]] filename [/?] The availability of certain del command switches and other command syntax might differ from operating system to operating system. Brush up on how to read command syntax if you're not sure how to interpret the syntax as it's shows above or described in the table below. Del Command Options Item Explanation /p Prompts for confirmation before deleting each file. /f Force deletes read-only files. /s Deletes the specified files from all the subdirectories. /q Quiet mode; suppresses prompts for delete confirmations. /a Deletes files based on one of the following attributes: r = Read-only files h = Hidden files i = Not content indexed files o = Offline files s = System files a = Files ready for archiving l = Reparse points /? Use the help switch with the del command to show detailed help about the command's several options. Executing del /? is the same as using the help command to execute help del. Del Command Examples Here are some examples showing how you can use the command: Delete File in Specific Folder del c:\windows\twain_32.dll In the above example, the del command is used to remove twain_32.dll located in the C:\Windows folder. Delete File From Current Folder del io.sys Here, the command has no path information specified, so the io.sys file is deleted from whatever directory you typed the command from. For example, if you type del io.sys from the C:\> prompt, the io.sys file will be deleted from C:\. Delete All EXE Files del C:\Users\Tim\Downloads\*.exe This one removes all EXE files from the Tim user's Downloads folder. The file extension could be replaced with * to delete every file from that folder. Notice there isn't a space after Downloads\. Adding a space would break the command and tell Windows to erase the Downloads folder instead of just the EXE files. Because the del command doesn't remove folders, it would erase every file from it, including not only EXE files but also images, documents, videos, etc. Delete Every Archived File del /a:a *.* Use this del command to delete every archived file in the current working directory. Similar to the io.sys command above, this one would execute on whatever folder Command Prompt is set to. Delete By Attribute and Extension del /q /a:r C:\Users\Tim\Documents\*.docx To combine a few of the del switches, consider this command which will delete every read-only (/a:r) DOCX file from the user's Documents folder, but will do so in quiet mode (/q) so that you're not asked to confirm it. Delete Files From Subfolders del /s C:\Users\Tim\Documents\Adobe\*.* This command will delete every file (*.*) from every folder (/s) inside the Adobe folder in the user's Documents directory. The folders will remain, but every file will get removed. However, in this example, you'll be prompted to enter Y for each file to confirm that you do, in fact, want to delete each one. To avoid that, if you're sure you want to delete every single file, you can add the /q switch before or after the /s switch to run the command in quiet mode. Just like with the DOCX example above, the wildcard (*.*) in this command can be changed to anything to remove only those files. Use *.MP4 for MP4s, *.MP3 for MP3s, etc. Del Related Commands The erase command is identical to the del command, so either can be used with the same result. In other words, you can replace "del" with "erase" in any of the command examples above without interrupting the instructions. The command forfiles is sometimes used with the del command to remove files that are so-many days old. For example, you might want to delete files that are older than a month in a specific folder, something you can do with forfiles and del but not with just the del command itself. In Windows XP and newer versions of Windows, rmdir is used to erase a whole folder, while deltree is used for the same purpose in operating systems older than Windows XP. In MS-DOS, the undelete command is used to restore files that were deleted with the delete command. To undo the del command in newer versions of Windows, try a file recovery program. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Subscribe Tell us why! Other Not enough details Hard to understand Submit Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up Newsletter Sign Up By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookies Settings Accept All Cookies