Alex Rivera | Logout

How do I prevent the "Could Not Find" error message from del *.txt?

Asked 2009-07-24T12:29:54.833
37

In a Windows batch-file, this line:

del *.txt

Will give the error/warning message:

Could Not Find C:\*.txt

if there are no files matching the pattern *.txt. Is there a way to prevent that message?

Edit
Report

1 Answer

36

If you want to suppress all error messages, you can do this:

del *.txt 2>NUL
answered 2009-07-24T12:40:30.923

Your Answer