美文网首页
bat 检测网络

bat 检测网络

作者: 阡洛 | 来源:发表于2020-07-06 13:40 被阅读0次
    bat检测网络并将具体时间写入日志文件
    @echo off
    set /p host=host Address:
    set logfile=Log_%host%.log
    echo Target Host = %host% >%logfile%
    for /f "tokens=*" %%A in ('ping %host% -n 1') do (echo %%A>>%logfile% && GOTO Ping)
    :Ping
    for /f "tokens=* skip=2" %%A in ('ping %host% -n 1') do (
    echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A>>%logfile%
    echo %date% %time:~0,2%:%time:~3,2%:%time:~6,2% %%A
    timeout 1 >NUL
    GOTO Ping)
    

    相关文章

      网友评论

          本文标题:bat 检测网络

          本文链接:https://www.haomeiwen.com/subject/ecmwqktx.html