持续ping ip或者域名并且加上时间戳,用于监控网络
@echo off set /p host=host: set logfile=ping_%host%.log echo Target Host=%host% > %logfile% :loop for /f "tokens=* skip=2" %%A in ('ping %host% -n 1') do ( echo %date:~0,-3% %time:~0,-3% %%A>>%logfile% echo %date:~0,-3% %time:~0,-3% %%A timeout /t 1 /nobreak>nul goto loop ) pause>nul
将代码保存为bat文件,运行之后输入需要ping的ip地址或者网址即可。
本文来自博客园,作者:迷神图卷,转载请注明原文链接:https://www.cnblogs.com/CryOnMyShoulder/p/15557054.html