How to delete files in MS-DOS without a prompt

Updated: 05/21/2018 by Computer Hope
Delete file

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.

Note

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

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.

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

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

If this command does not work, we would recommend you create a batch file with the following 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 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.

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.