Windows batch file – replace a string in an XML file-Collection of common programming errors
Batch will have trouble with , ^ and & characters. This will work, but a JScript/VBScript script (like is referenced in one of the comments) is a much better solution.
Change “ORIGINAL” to the text being searched for, and “REPLACE” to the new text. I recommend for Windows scripting to learn JScript.
@echo off
for /f "tokens=* delims=" %%f in ('type sometext.txt') do CALL :DOREPLACE "%%f"
GOTO :EOF
:DOREPLACE
SET INPUT=%*
SET OUTPUT=%INPUT:ORIGINAL=REPLACE%
for /f "tokens=* delims=" %%g in ('ECHO %OUTPUT%') do ECHO %%~g>>out.txt
EXIT /b
:EOF