GoldAngel
Код: @echo off
setlocal enabledelayedexpansion
set file=config.ini
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find "IP-"') do set currIP=%%a
set currIP=%currIP:~1%
for /f "skip=2 delims=[] tokens=1" %%a in ('find /n "127.0.0.1" %file%') do (
set line=%%a
del /q tmp_file 2>nul
set counter=0
for /f "tokens=*" %%b in (%file%) do (
set /a counter+=1
if !counter!==!line! (
for /f "tokens=1 delims==" %%c in ('echo %%b') do set qaz=%%c
if /i !qaz!==IP (
echo IP=%currIP%>> tmp_file
) else (
echo %currIP%>> tmp_file
)
) else (
echo %%b>>tmp_file
)
)
del /q %file% 2>nul
ren tmp_file %file%
)
Код: @echo off
setlocal enabledelayedexpansion
set file=config.ini
for /f "tokens=2 delims=:" %%a in ('ipconfig ^| find "IP-"') do set currIP=%%a
set currIP=%currIP:~1%
for /f "skip=2 delims=[] tokens=1" %%a in ('find /n "127.0.0.1" %file%') do (
set line=%%a
del /q tmp_file 2>nul
set counter=0
for /f "tokens=*" %%b in (%file%) do (
set /a counter+=1
if !counter!==!line! (
for /f "tokens=1 delims==" %%c in ('echo %%b') do set qaz=%%c
if /i !qaz!==IP (
echo IP=%currIP%>> tmp_file
) else (
echo %currIP%>> tmp_file
)
) else (
echo %%b>>tmp_file
)
)
del /q %file% 2>nul
ren tmp_file %file%
)