del [/P] [/F] [/S] [/Q] [/A[[:]attributes]] namesThe following are the possible options for the del command:
| Name | Description |
|---|---|
Names |
Specifies a list of one or more files or directories. Wildcards may be used to delete multiple files. If a directory is specified, all files within the directory will be deleted |
/P |
Prompts for confirmation before deleting each file. |
/F |
Force deletes of read-only files. |
/S |
Deletes specified files from all subdirectories. |
/Q |
Quiet mode, do not ask if ok to delete on global wildcard. |
/A |
Selects files to delete based on attributes. |
attributes |
R Read-only filesS System filesH Hidden filesA Files ready for archiving |
Examples
The following script will delete the file test.bat in the current directory, if the file exists.
del test.batThe following command will delete the file C:\test.bat in the current directory, if the file exists.
del c:\test.batThe * (asterisk) character is a wildcard. *.bat indicates that you want to delete all bat files in the c:\directory.
del c:\*.batThe ? (question mark) is a single wildcard character for a letter. Using this command in the following example will delete any file ending with est.tmp, such as best.tmp or test.tmp.
del c:\?est.tmp