I have written a batch script to replace a string in text file.
Following is the script.
@echo off &setlocal
set "search=%1"
set "replace=%2"
set "textfile=Input.txt"
set "newfile=Output.txt"
(for /f "delims=" %%i in (%textfile%) do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
echo(!line!
endlocal
))>"%newfile%"
del %textfile%
rename %newfile% %textfile%
But for a 12MB file, it is taking close to 7 min. I want it to be under a minute. Can we make use of find or findstr command to reduce the time taken?