Replace text in file

July 9, 2009 at 09:22:04
Specs: Windows Vista
I want to replace some text fields in a file. The file will be similar to :
This is %name1%
This is %name2%
This is %name3%

And I will be writing different files based on the 3 name parameters. I want to be able to pass these 3 names as parameters to the batch file, so that it writes the names to the file. In other words, if I enter "Changeit.bat dog cat horse", I want an output file that reads:
This is dog
This is cat
This is horse

(I have simplified the output file greatly, but if I can get this to work, I can apply it to the big file).


See More: Replace text in file

Report •

July 9, 2009 at 11:13:50
@echo off > newfile & setLocal enableDELAYedexpansion

>> newfile echo This %1
if "%1" neq "" goto :loop

If at first you don't succeed, you're about average.


Report •

July 9, 2009 at 12:59:55
That's fantastic! Thans for the quick reply.


Report •

Related Solutions

Ask Question