Continuous ping script under Windows
Early monitoring of the connectivity of a host script, in the DOS batch of the use for, variables, etc. sometimes can not be remembered, put in the disk to find inconvenient, so there is this article.
@echo offSetip_addr=192.168.1.17: RepeatREMGet system Current date for/f%%i in ('Date/t ') Do SetVardate=%%iREMGet system Current time for/f%%i in (' Time/t ') Do SetVartime=%%iping-n1%ip_addr% >NULLif%ERRORLEVEL%==0 (Setresult=OKREMDelayPing-n 1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >NULL)Else(Setresult=ERRORREMDelayPing-n 1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >Nullping-n1 x.x.x.x >NULL)Echo%vardate%%vartime%-%result% (DEST:%ip_addr%)Echo%vardate%%vartime%-%result% (DEST:%ip_addr%) >> "%~dp0ping_log-%ip_addr% [%vardate%].log]
Continuous ping script under Windows