Remove lines containing string in multiple text files with PowerShell

Run PowerShell from the root directory and it will scan through all .bat files and remove every line in each file that contains lorem ipsum.

foreach($file in (dir -r -i *.bat -force)) { $cleaned = gc $file | where { $_ -notlike "*lorem ipsum*" }; sc $file $cleaned }