[Solved] Batch script that will allow to search a particular IP and change it to a new IP address in a .ini file


Try below updated code, please let me know if you still face issues

 cls 
 @Echo Off 
 SetLocal EnableDelayedExpansion 
 if exist new.ini ( del /s /q new.ini ) 
 set "search=1.1.1.1"
 set "search2=2.2.2.2"
 set "replace=7.7.7.7"
 set "replace2=8.8.8.8"
 for /F "tokens=*" %%a in (Apservice.ini) Do ( 
 Set "filevalue=%%a" 
 Set filevalue=!filevalue:%search%=%replace%!
 Set filevalue=!filevalue:%search2%=%replace2%!
 Echo !filevalue!>>new.ini 
 ) 
 move /y new.ini Apservice.ini 
 ause

16

solved Batch script that will allow to search a particular IP and change it to a new IP address in a .ini file