<p>I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions?</p>

I don't think there's a way to do it with any built-in commands. I would suggest you download something like
Gnuwin32
or
UnxUtils
and use the
```
sed
```
command (or download only
```
sed
```
):
```
```
sed -c s/FOO/BAR/g filename
```
```