@echo off setlocal enabledelayedexpansion set "id="id"" set "port="port"" set "ip="ip"" set "updateDate="updateDate"" set "theend=;" (for /f "delims=" %%a in (' findstr "%id%.*%updateDate%" "001.json"') do ( ? ? set "str=#%%a" ? ? set "str=!str:%id%=ж!" ? ? set "str=!str:%updateDate%=ж!" ? ? for /f "tokens=2 delims=ж" %%b in ("a!str!") do echo;%id%%%b ))>"test.txt" (for /f "delims=, tokens=1,6" %%c in (test.txt) do ( set "sto=%%c" set "sto=!sto:"=!" set "sto=!sto:id:=!" set "stp=%%d" set "stp=!stp:"=!" echo !sto!%theend%!stp!%theend% )) > 003.txt for /f "tokens=16" %%e in ('ipconfig ^|find /i "ipv4"') do ( set ipaddress=%%e) ? ? ? ? ? ? ? ? ? ?? findstr "%ipaddress%" "003.txt">nul && goto 2 :1 echo don't ip pause goto next :2 echo ip xiangtong REM exit REM :next REM exit? findstr "%ipaddress%" 003.txt >test.txt for /f "delims=.; tokens=1,2,3,4,5" %%h in (test.txt) do ( set "h=%%h" set "i=%%i" set "l=%%j"? set "k=%%k" set "l=%%l" ) Set "nuv=000%h%"&Set "nuv=!nuv:~-6!" Set "nub=000%i%"&Set "nub=!nub:~-3!" Set "nun=000%j%"&Set "nun=!nun:~-3!" Set "num=000%k%"&Set "num=!num:~-3!" Set "nul=000%l%"&Set "nul=!nul:~-3!" echo %nuv%_%nub%_%nun%_%num%_%nul% >003.txt? REM (for /f "delims=" %%l in (test.txt) do ( REM set "stl=%%l" REM set "stl=!stl::=!" REM set "stl=!stl:.=_!" REM set "stl=!stl:;=!" REM set "stl=!stl:id=000!" REM set "stl=!stl:ip=_!" REM echo !stl! )) > 003.txt for /f "delims=" %%r in (003.txt) do ( ? ?? ?set "ui=%%r") (for /f "delims=" %%t in (zabbix_agentd.conf) do ( ? ? set "sty=%%t" ? ? set "sty=!sty:Windows host=%ui%!"?? ? ? ? echo !sty! )) >003.txt ?? ?move /y 003.txt "zabbix_agentd.conf" 2>nul 1>nul? ? ? if %errorlevel% == 0 (echo Change OK!) pause del c:\zabbix\conf\test.txt ? ? ? ? ? ? start cmd start cd ..? start cd bin start zabbix_agentd.exe -c zabbix_agentd.conf -x start zabbix_agentd.exe -c zabbix_agentd.conf -s
|