NT Syntax

PING

Test a network connection - if successful, ping returns the ip address.

syntax
      PING [options] destination_host

options
    -w timeout     Timeout in milliseconds to wait for each reply.
    -i TTL         Time To Live.
    -v TOS         Type Of Service.
    -a             Resolve addresses to hostnames.
    -n count       Number of echo requests to send.
    -t             Ping the destination host until interrupted.
    -l size        Send buffer size.
    -f             Set Don't Fragment flag in packet.
    -r count       Record route for count hops.
    -s count       Timestamp for count hops.
    -j host-list   Loose source route along host-list.
    -k host-list   Strict source route along host-list.
destination_host  The name of the remote host

A successful PING does NOT always return an %errorlevel% == 0
Therefore to reliably detect a successful ping - pipe the output into FIND and look for the text "TTL"

Note that "Reply" in the output of PING does not always indicate a positive response. You may receive a message from a router such as: Reply from 192.168.1.254: Destination Net Unreachable.

Examples

PING -n 1 -w 7500 Server_06

PING -w 7500 MyHost |find "TTL=" && ECHO MyHost found

PING -w 7500 MyHost |find "TTL=" || ECHO MyHost not found

PING -n 5 -w 7500 www.microsoft.com

PING -n 5 -w 7500 microsoft.com

PING stands for Packet InterNet Groper

Related Commands:

TRACERT - Trace route to a remote host
IPCONFIG - IP Configuration
PATHPING - Route Tracing tool (Windows 2000)
RPings - RPC Connectivity Verification Tool (Win 2K but works with NT)

Q115388 - Resolving IP Address with Leading Zero

Equivalent Linux BASH commands:

ping -

trace - Find the IP address of a remote host.



Simon Sheppard
SS64.com