This is what I just miss. I am sure that this does not work as I need due to the nested loop. This is a simple script that I deleted somewhere and changed a bit so that more testing can be done. Essentially, it just delays the host with a delay again and again for the entire time until you close it, but it logs the failed responses. Everything works, but for a living I can't figure out how to get it to update the name used in the for loop.
@echo off setlocal enabledelayedexpansion :: ** Enter name to identify host in log ** set name1=Test 1 set name2=Test 2 set name3=Test 3 :: ** Enter IP or HOSTNAME to test against ** set hostIP1=1.1.1.1 set hostIP2=2.2.2.2 set hostIP3=3.3.3.3 :: ** Enter Delay in milliseconds between each test ** set delayMS=2000 title -DO NOT CLOSE- Ping Test echo DO NOT CLOSE echo Ping Test :loop set namecount=1 for %%x in (%hostIP1% %hostIP2% %hostIP3%) do ( set pingline=1 set pingname=name!namecount! for /f "delims=" %%A in ('ping -n 1 -w 2000 -l 255 %%x') do ( if !pingline! equ 2 ( set logline=!date! !time! "%%A" - %%x !%pingname%! echo !logline! | find "TTL=">nul || echo !logline! >> pinglog.txt ) set /a pingline+=1 ) set /a namecount+=1 ) sleep -m %delayMS% goto loop
I usually use a different language, but I need something that works on all Windows servers. It seems the surest way. Thanks
source share