I need a batch file that should search the PC for all files issued today named as \"example.ini\" and replaces a string which will be in the second line of \"example.ini\", it s
Test this on some sample files.
It will change the example.ini
files on c:\
and in subdirectories which contain SERVER_IP=212.83.63.108
and will change it to SERVER_IP=222.22.22.222
It uses a helper batch file called repl.bat
from - https://www.dropbox.com/s/qidqwztmetbvklt/repl.bat
Place repl.bat
in the same folder as the batch file.
@echo off
for /r c:\ %%a in (example.ini) do (
find "SERVER_IP=212.83.63.108" <"%%a" >nul && (
echo processing "%%a"
type "%%a"|repl "SERVER_IP=212\.83\.63\.108" "SERVER_IP=222.22.22.222" >"%%a.tmp"
move /y "%%a.tmp" "%%a" >nul
)
)