Deleting files in MS-DOS without a prompt

DeleteBy default MS-DOS and the Microsoft Windows command line will not prompt a user or give a user a prompt or warning when deleting files on a computer using the del command. However, when attempting to delete a directory using the del, deltree, or rmdir command on a directory that is not empty you will receive a warning or error message about deleting the directory.

Note: When deleting anything from MS-DOS or the Windows command line it is not sent to the Recycle Bin.

Deltree command

To suppress the prompting use the deltree command and add the tag /y, as shown in the example below.

deltree c:\windows\temp\*.* /y

Note: This does not work in all versions of Windows and MS-DOS.

If this command does not work we would recommend that you create a batch file with the below command in the batch file.

echo y | del %1\*.*

Once created, you can type the name of the batch file then the name of the directory that you wish to delete.

Rd and rmdir command

Users who wish to delete a directory containing files in a Windows command line window running under Microsoft Windows 2000 or later can also use the rmdir or rd command with the /S option.

Erase command

If you're running a later version of Microsoft Windows and using the Windows command line you can also use the erase command to delete files without a prompt.

Additional information

  • See our delete definition for further information on this term and related links.
  • See our del, rmdir, and erase command pages for further information on all of these commands.