Home > Commands A-M > Commands Da-Dr


Description | Syntax | Parameters | Switches | Related | Notes | Examples | Errorlevels | Availability

Deletes the one or more files you specify.


DEL /?

DEL [drive:][path]filename [/A[[:]attributes]] [/F] [/P] [/Q] [/S]


ERASE [drive:][path]filename [/A[[:]attributes]] [/F] [/P] [/Q] [/S]

drive: (v1.0 Win95 NT3.5)
Specifies the drive location of the file or set of files you want to delete.
path (v2.0 Win95 NT3.5)
Specifies the path location of the file or set of files you want to delete.
filename (v1.0 Win95 NT3.5)
Specifies the name of the file or set of files you want to delete.

/? (NTXP)
Display help.
/A[[:] attributes] (NT3.5)
Displays only the names of those directories and files with the attributes you specify. If you omit this switch, DIR displays the names of all files except hidden and system files. If you use this switch without specifying attributes, DIR displays the names of all files, including hidden and system files. The list describes each of the values you can use for attributes. The colon (:) is optional. Use any combination of these values, and do not separate the values with spaces:
/F (NT3.5)
Ignore read-only setting and delete anyway (FORCE).
/P (v4.0 Win95 NT3.5)
Prompts you for confirmation before deleting the specified file.
/Q (NT3.5)
Quiet mode, do not give a Yes/No Prompt before deleting.
/S (NT3.5)
Delete from all Subfolders (DELTREE).
Shows only the files that are deleted, not the ones it could not find when Command Extensions are enabled.


For information about retrieving a deleted file, see the UNDELETE command.
For information about removing a directory, see the RMDIR command.
For information about deleting a directory, its files, and all subdirectories and files subordinate to it, see the DELTREE command.
The resource kit utility rm.exe will sometimes delete files where DEL fails

Using the /P switch

If you use the /P switch, DEL displays the name of a file and prompts you with a message in the format:

    filename, Delete (Y/N)?

Press Y to confirm the deletion, N to cancel the deletion and display the next filename (if you specified a group of files), or CRTL+C to stop the DEL command.

Deleting more than one file at a time

You can delete all the files in a directory by typing the DEL command followed by [drive:]path. You can also use wildcards (* and ?) to delete more than one file at a time. However, you should use wildcards cautiously with the DEL command to avoid deleting files unintentionally. Suppose you type:

    DEL *.*

DEL displays the prompt:

    All files in directory will be deleted! Are you sure (Y/N)?

Press Y and then ENTER to delete all files in the current directory, or press N and then ENTER to cancel the deletion.

Before you use wildcards with the DEL command to delete a group of files, you can use the same wildcards with the DIR command to see a list of the names of all the files included in the group.

CAUTION: Once you delete a file from your disk, you may not be able to retrieve it. Although the UNDELETE command can retrieve deleted files, it can do so with certainty only if no other files have been created or changed on the disk. If you accidentally delete a file that you want to keep, stop what you are doing and immediately use the UNDELETE command to retrieve the file.

For more information on undeleting files, see the chapter "Managing Your System" in the DOS User's Guide.

DEL as abbreviation for ERASE

DEL was allowed as an abbreviation since v1.1


To delete the CAT.TMP file from the TEST directory on drive C, you can use either of:



To delete all the files in a directory named TEST on drive C, you can use either of:


    DEL C:\TEST\*.*



v1.0 v1.05 v1.1 v1.11 v1.24 v1.25 v1.85 v2.0 v2.01 v2.05 v2.10 v2.11 v2.11R v2.12 v2.2 v2.25 v3.0 v3.20 v3.05 v3.1 v3.21 v3.25 v3.30 v3.3A v3.3R v3.3T v3.31 v3.40 v4.0 v4.01 v4.01A v5.0 v5.0A v5.00.02 v5.001A v5.01 v5.02 v6.0 v6.10 v6.2 v6.21 v6.22 v6.23 v7.00 v7.0R1 v7.10 v8.00
Win95 Win98 WinME
Windows NT
NT3.5 NT4 NT2000 NTXP NT2003