setlocal enabledelayedexpansion
Set infile=config.ini
Set find=pc-name
Set replace=%COMPUTERNAME%
setlocal enabledelayedexpansion
set COUNT=0
for /F "eol=# tokens=* delims=," %%n in (!infile!) do (
set LINE=%%n
set TMPR=!LINE:%find%=%replace%!
Echo !TMPR!>>TMP.TXT
)
copy %infile% %infile%.bak
move TMP.TXT %infile%
setlocal enabledelayedexpansion
Set infile=config.ini
Set find=pc-name
Set replace=%COMPUTERNAME%
setlocal enabledelayedexpansion
set COUNT=0
for /F "eol=# tokens=* delims=," %%n in (!infile!) do (
set LINE=%%n
set TMPR=%LINE%
if "%LINE:HOST=HOZZZT%" neq %LINE% Echo !TMPR!>>TMP.TXT else Echo !LINE!>>TMP.TXT
)
copy %infile% %infile%.bak
move TMP.TXT %infile%