This uses a helper batch file called repl.bat
- download from: https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
Place repl.bat
in the same folder as the batch file or in a folder that is on the path.
Repl.bat is a hybrid batch file using native Windows scripting and is far faster than a regular batch script.
The L
switch makes the text search and replace a literal string and I'd expect the 12 MB file to complete in several seconds on a modern PC.
@echo off &setlocal
set "search=%~1"
set "replace=%~2"
set "textfile=Input.txt"
set "newfile=Output.txt"
call repl.bat "%search%" "%replace%" L < "%textfile%" >"%newfile%"
del "%textfile%"
rename "%newfile%" "%textfile%"