среда, 12 апреля 2023 г.

Скрипт пинговать несколько адресов

@echo off
set PING_CMD=ping.exe -n 1 -w 10
set LOG=C:\!Scripts\ipsec_ping.log
set IPLIST=C:\!Scripts\ipsec_ping.txt
::echo %Date:~6,4%%Date:~3,2%%Date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% > %LOG%

FOR /F UseBackQ %%A IN ("%IPLIST%") DO ( %PING_CMD% %%A | find "TTL=" > NUL && echo %Date:~6,4%%Date:~3,2%%Date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% %%A OK >> %LOG% || echo %Date:~6,4%%Date:~3,2%%Date:~0,2%%time:~0,2%%time:~3,2%%time:~6,2% %%A NO >> %LOG%)

ipsec_ping.txt:
10.80.21.201
10.80.21.202
10.33.70.1
10.91.130.254
10.88.1.1

Ратнер Арсений, arsenyratner@gmail.com, 7 985 273 2090