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?
I've used this tool extensively to accomplish similar tasks: http://fart-it.sourceforge.net/ (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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With