Batch ERRORLEVEL ping response

前端 未结 13 1813
走了就别回头了
走了就别回头了 2020-12-14 23:05

I\'m trying to use a batch file to confirm a network connection using ping. I want to do batch run and then print if the ping was successful or not. The problem is that it a

13条回答
  •  长情又很酷
    2020-12-14 23:45

    The most simple solution to this I can think of:

    set error=failure
    ping racer -n 1 -w 100>nul 2>&1 && set error=success
    

    Of course, -w needs to be adjusted if on a slow link (100ms might be too short over Dialup ;-))

    regards

提交回复
热议问题