Batch Script - Find and replace text in multiple files in a directory

I am new to writing batch scripts. I am in need of a simple batch file that searches for a text (eg., FOO) and replaces it with another text (eg., BAR) in all the text files within a folder and it's sub-folders.

I need to give this batch file to the user. So, it is not possible to ask the user to install anything else. Can someone please help me with this?


ANSWERS:


I've used this tool extensively to accomplish similar tasks: (Despite its name, it is a very handy tool).

For example, this command performs a search of all TXT files in the "C:\Dir\To\Files" (+subfolders) replacing all occurances of FOO with BAR. The -i switch performs a case-insensitive search.

FART -i -r "C:\Dir\To\Files\*.txt" FOO BAR

I believe your question has already been answered. At least for replacing text.

Adding more information would also be helpful in assessing your problem. Like if the text files mentioned are created by a script.



 MORE:


 ? Find and replace line starts with specific value in text file via windows batch file
 ? Remove folders from txt file in windows cmd
 ? replacing line in txt file AFTER specific line
 ? How to concatenate 2 .csv files in 1 .csv file with multiple sheets using Batch commands
 ? How to remove strings from a text file using batch script?
 ? How to remove strings from a text file using batch script?
 ? How to remove strings from a text file using batch script?
 ? How do I check that a parameter is defined when calling a batch file?
 ? Batch To Remove Character From A String
 ? How to edit multiple text lines in a .ini file using batch script