Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit editor mode

del

Feedback

In this article

Deletes one or more files. This command performs the same actions as theerase command.

Thedel command can also run from the Windows Recovery Console, using different parameters. For more information, seeWindows Recovery Environment (WinRE).

Warning

If you usedel to delete a file from your disk, you can't retrieve it.

Syntax

del [/p] [/f] [/s] [/q] [/a[:]<attributes>] <names>erase [/p] [/f] [/s] [/q] [/a[:]<attributes>] <names>

Parameters

ParameterDescription
<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.
/pPrompts for confirmation before deleting the specified file.
/fForces deletion of read-only files.
/sDeletes specified files from the current directory and all subdirectories. Displays the names of the files as they are being deleted.
/qSpecifies quiet mode. You are not prompted for delete confirmation.
/a[:]<attributes>Deletes files based on the following file attributes:
  • r Read-only files
  • h Hidden files
  • i Not content indexed files
  • s System files
  • a Files ready for archiving
  • l Reparse points
  • - Used as a prefix meaning 'not'
.
/?Displays help at the command prompt.

Remarks

  • If you use thedel /p command, you'll see the following message:

    FileName, Delete (Y/N)?

    To confirm the deletion, pressY. To cancel the deletion and to display the next file name (if you specified a group of files), pressN. To stop thedel command, press CTRL+C.

  • If you disable command extension, the/s parameter will display the names of any files that weren't found ,instead of displaying the names of files that are being deleted.

  • If you specify specific folders in the<names> parameter, all of the included files will also be deleted. For example, if you want to delete all of the files in the\work folder, type:

    del \work
  • You can use wildcards (* and?) to delete more than one file at a time. However, to avoid deleting files unintentionally, you should use wildcards cautiously. For example, if you type the following command:

    del *.*

    Thedel command displays the following prompt:

    Are you sure (Y/N)?

    To delete all of the files in the current directory, pressY and then press ENTER. To cancel the deletion, pressN and then press ENTER.

    Note

    Before you use wildcard characters with thedel command, use the same wildcard characters with thedir command to list all the files that will be deleted.

Examples

To delete all the files in a folder named Test on drive C, type either of the following:

del c:\testdel c:\test\*.*

To delete all the files in a folder where the folder has a space in its name, the full path needs to be wrapped in double quotes. Type either of the following:

del "c:\test folder\"del "c:\test folder\*.*"

To delete all files with the .bat file name extension from the current directory, type:

del *.bat

To delete all read-only files in the current directory, type:

del /a:r *.*

Related links


Feedback

Was this page helpful?

YesNoNo

Need help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?

  • Last updated on

In this article

Was this page helpful?

YesNo
NoNeed help with this topic?

Want to try using Ask Learn to clarify or guide you through this topic?

Suggest a fix?