In this guide, we’ll learn how to use the “Del” command in Windows 10. This command is used to delete files, folders, and data from the directory. We write the Del command in a simple syntax and set multiple attributes to perform the various task. There are two common syntaxes, del and erase, that we can use to delete.
del [/p] [/f] [/s] [/q] [/a[:]][<Attributes>] <Names> erase [/p] [/f] [/s] [/q] [/a[:]][<Attributes>] <Names>
We can use the following parameters with the “Del” command. Here are the following parameters and its uses.
|/p||Prompt confirmation box before deleting|
|/f||Force to delete|
|/s||Delete all the files from the current directory and its subdirectories|
|/q||Ignore the deletion confirmation|
|/a[:]||r Read-only files|
h Hidden files
i Not content indexed files
l Reparse points
s System files
a Files ready for archiving
|<Names>||Files or folder name, you want to delete|
Del Command Usages
- If you use del /p <name>, It prompts the following message to take your confirmation.
Filename, Delete (Y/N)?
Type Y for yes and N for No. You can abort this using the Ctrl+C key, In case you don’t want to delete the file.
- del /f <name>, It will force the computer to delete the selected file. This command is applicable for read-only files.
- del /s, It will delete all the files from the directory and subdirectories, and display file name with a confirmation prompt.
- Similarly, you can use /q and /a[:] attributes. q is for without confirmation deletion, and /a:r is for the read-only files.
Type del /a:r, this will delete all the read-only files form the current folder.
To delete all the files from the folder, you can use the following command. For example, you have a folder named test-folder, then you can use the following command.
Command: del test-folder
This command does delete all the files form the test-folder. You can use Wildcard (*) to delete all the files at once, but when you run the above command it automatically appends this \* at the end.
Command: del test-folder\*
To delete some specific files, you can specify the file extension name. For example, you want to delete all the files having a .bat extension; you can then run the following command.
Command: del *.bat
This command will delete all the files having bat extension.
This is all about how to use the “Del” command in Windows 10. Hopefully, you enjoyed this guide. And now you probably be master in command prompt when to use the del command.