|I believe that "dos" has to rewrite the file. The echo >> apends it to the end of a file. There isn't a single command to write into a text file.|
this is a simple example
::prompts for initial string to add a line after
set /p search1="enter exact search string: "
set /p addon="please enter addition: "
::this statement pulls sample.txt line by line and looks for the %search1%
::and then "adds in" the %addon%
for /f "tokens=*" %%G IN (sample.txt) DO echo %%G>>sample2.txt && if %search1% EQU %%G echo %addon%>>sample2.txt
::displays contents of replacement
::if you want to replace origional remove the double colon
::ren sample2.txt sample1.txt