How to use Delete “del command” on Windows 11

In this guide, we’ll learn how to use the “Del” command on Windows 11. This command utility is used to delete files, and folders 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 perform the deletion operation.

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 their uses.

ParameterDescription
/pPrompt confirmation box before deleting
/fForce to delete
/sDelete all the files from the current directory and its subdirectories
/qIgnore 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 names, you want to delete

Del command usages on Windows 11

  1. 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.
  2. del /f <name>, It will force the computer to delete the selected file. This command is applicable for read-only files.
  3. del /s, It will delete all the files from the directory and subdirectories, and display file name with a confirmation prompt.
  4. 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 from 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 from 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 on Windows 11. I hope, this guide is helpful for you, if you have any questions, feel free to ask in the comment section below.

You might like:

Leave your reply here

Scroll to Top