Batch ERRORLEVEL ping response

前端 未结 13 1817
走了就别回头了
走了就别回头了 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:59

    Testing for 0% loss may give a false positive, in this scenario: Let's say you normally have a network drive on some_IP-address, and you want to find out whether or not it's on.

    If that drive is off, and you ping some_IP-address, the IP address from which you ping, will respond:
    Answer from your_own_IP-address: target host not reachable
    ... 0% loss

    You might be better off using if exist or if not exist on that network location.

提交回复
热议问题