By 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, ensure that it isn’t empty or you will receive a warning or error.

Deltree command

To suppress prompting, use the deltree command with /y, as shown in the example below that deletes all files in the Windows temp directory.

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

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

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

The above command does not work in all versions of Windows and MS-DOS.

echo y | del %1*.*

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

Rd and rmdir command

Users who want to delete a directory containing files in a Windows command line version 2000 or later can also use the rmdir or rd command with the /S option.

  • Rd and rmdir command help.

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.

  • Erase command help.
  • See our delete definition for further information and related links.
  • See our del command pages for further information on each.
  • MS-DOS and Windows command line help and support.