Command to Delete Files That Contain a String in MS-DOS

Simple little tip here to delete all files in a directory that contain a given string using findstr, for and del.

for /f "delims=" %f in ('findstr /m "yourstring" *.*') do @del /f /q %~f

Leave a Reply

Your email address will not be published. Required fields are marked *