Supressing Prompts In Batch Files While Deleting All Files

Posted December 6, 2003 by AlexTheBeast in Batch file programming

Successful batch files cannot be slowed down with a bunch of user prompts. This little tech-recipe will show you how to supress prompts in batch files.


Commands such as deleting all files can complicate batch files because the system prompts for confirmation. For example…

del *.* replies with *.*, Are you sure (Y/N)?

Man, that’ll slow up a batch file.

By using echo this will automatically reply for you:

echo y| del *.*

To supress the “File Not Found” error when trying to delete files from an empty directory, use this code instead:

if exist *.* echo y| del *.*

The Conversation

Follow the reactions below and share your own thoughts.