I am not sure what you mean by 'the source'
I am not sure what you mean by 'in a loop'
Loops in batch are implemented with the FOR command or by gotos. The FOR command processes a dataset which can be an explicit list
for %%A in (cat dog owl horse) do (
echo Animal is %%A
)
or using the /f switch a source of lines such as a file or the console output of a command or program:
for /f %%A in (animals.txt) do (
echo Animal is %%A
)
So what is the reason for doing it in a loop?
[EDIT] I believe I see what you are getting at.... you want to cycle through all the substitutions... ?