Team Windows string, as a rule, is not used by most users, perhaps because not everyone knows what commands to use in this or that case, how useful it can sometimes be, or even what it is?

If you are one of those users, I hope this article will help you get started using it. Perhaps you just forgot some command, and here I hope to help you.

At first glance, rj may seem like a boring, complicated or useless tool, but I assure you, it is not so!

This article is intended solely as an introduction to some of the many useful commands.

Basic cmd commands.

1. Force stop the running process Ctrl+C

The first command you should know is pressing two keys Ctrl and C at the same time. This combination stops almost any team. If you find an error in the command you entered, you can simply erase unnecessary characters using the backspace button, but if you have already run the wrong thing, you can use the Ctrl+C combination.

Attention! This command is not a magic wand! It will not be able to cancel processes that cannot be canceled, so be careful!

2. Call help using the command /?

The second command you should remember is /? . By typing these two characters after another command, you will see help for the command you are interested in. For example:

3. Information about your network connection

This command will display information about your connection by local network:

You can find out more complete information about your computer by typing the command.

4. Ping check (connection check) ping

Let's say you have two computers connected via an Ethernet cable (we have already discussed how to crimp a cable to create a local network earlier). You need to be sure that there is a connection between them. To do this, you need to run ping 192.168.0.5 from a computer whose IP address is 192.168.0.1 (where 192.168.0.5 is the IP address of the second computer).

If everything is in order, then pings will appear in front of you. If something is done wrong, you will see the message The specified node is unavailable. Stop this command you can with Ctrl+C .

5. Exit command line exit.

You can close the command line window with the exit command.

6. Copying files xcopy.

A very useful tool for copying files. Let's say you want to copy photos from drive C to an external drive.

Dial xcopy c:photo f:photo /s /e(where f is the external drive).

6. Checking time time.

If you need to adjust by typing time you will be presented with the current time. And here you will be offered to change the time to the correct one.

7. Open a new command window cmd lines or start .

Enter the cmd or start command and a new command prompt window will open in front of you. You can also simply clear the current window. To do this, type the command cls (clear screen).

8. System check sfc files/scannow.

Malware sometimes tries to replace system kernel files with modified versions in order to gain control of the system. System File Checker can be used to check the integrity of files Windows systems. If any files are damaged or deleted, they will be replaced.

9. Information about installed drivers driverquery.

If you want to see what drivers are installed on your PC, you can do so by running the driverquery command. This command provides information about each driver you have.

If you need a little more information, you can add the Latin letter V (here's what driverquery-V would look like).

10. Find out the IP address of the site nslookup site.ru

Type nslookup site.ru in the command line to find out the IP address of site.ru.

11. Insert text

In order to paste text into the command line, you need, as usual, to copy it from the source, and then simply right-click once in the black screen area.

Everyone is familiar with situations when the Internet on a computer suddenly breaks down; this behavior can be observed when using ADSL modems, Wifi over a long distance, GSM and other similar unreliable technologies. You can quickly find out whether your computer has Internet access using the ping utility.

But its scope is much wider, it is used by network administrators to check the availability of a remote node on the network, it is used in various scripts and many other places. This article will look at the ping command in Linux, we will talk about how to use the utility, how it works, and consider its options and capabilities.

The ping utility is a very simple network diagnostic tool. It allows you to check whether the remote host is accessible or not and that’s all. To do this, the utility checks whether the host can respond to network requests using the ICMP protocol.

I hope it goes without saying that all data over the network is transmitted in the form of small packets. The program transmits a small packet with ICMP data and expects to receive a response packet back; if it receives it, it is considered that the remote host is accessible. ICMP or Internet Control Message Protocol is an extension of the IP protocol that is used to transmit service messages and error messages.

The ICMP protocol can only transmit two types of packets: error reporting messages and request messages. In turn, request messages are divided into:

  • Echo request message;
  • Echo reply message.

Let's try to figure out what the ping command does. So, when you send a ping request to a remote host, the utility sets a unique ID for each packet, as well as the TTL and time the packet was sent. If the host is available, it sends a response, based on the time it was sent, the utility can calculate the round trip time of the packet. Then the next packet is sent. At the end, the total number of sent and received packets, the percentage of losses and other data are calculated.

Ping command

Now we just have to practice a little. But before we get into practice, let's look at the command syntax and its options. The syntax is quite simple:

$ ping options host_address

The ping command format is very simple. As a host address, you can transmit either an IP address or domain name. Options configure the behavior of the utility. Let's consider the main ones:

  • -4 - use only ipv4 (default);
  • -6 - use only ipv6;
  • -A- adaptive mode, the time between packet sendings adapts to the time of packet transmission and reception, but not less than 200ms;
  • -b- allow ping of broadcast address;
  • -With- the number of packets to be sent;
  • -D- display time as UNIX timestamp;
  • -f- flood mode, in this mode packets are transmitted without delay, can be used to carry out DoS attacks on individual nodes. The number of dots that the utility displays indicates the number of lost packets;
  • -i- interval in seconds between sending packets;
  • -I- use this network interface to send packets;
  • -l- overload mode, a lot of packets are sent and the system does not monitor response packets;
  • -n- do not receive domains for IP addresses;
  • -r- ignore routing tables and send the packet to the specified interface;
  • -s- size of one package;
  • -t- set TTL manually;
  • -v- more detailed output.

Now that we have looked at the basic parameters of the ping command and its syntax, it’s time for practice, then we’ll talk about how to ping a specific node in Linux.

How to use Ping?

To check the health of the network, the ping program is often used to ping any site that is always accessible, for example, google.com or even simpler and shorter ya.ru. All you have to do is pass this address to the utility in the parameters, it will find the ip itself and do everything necessary:

As I wrote above, for each packet a unique identifier icmp_seq is displayed, the number of nodes to the target ttl node and the time spent on delivering the packet time. To stop ping, press the keyboard shortcut Ctrl+C. At the end, the utility displayed general statistics:

  • packets transmitted- packages sent;
  • received- packets received;
  • packet loss- percentage of lost packets;
  • time- total working time;
    rtt min/avg/max/mdev- minimum time/average time/maximum time/standard deviation.

If the ping command is not stopped, packets may be sent very quickly. for a long time, this creates additional load on the server and is therefore not advisable. You can immediately limit the number of packets sent in the command call using the -c option:

Just like we ping a domain, you can specify the IP address directly. This allows you to check whether there is a network when the DNS servers are configured incorrectly. For example:

ping -c 3 8.8.8.8

The next type of sending ping messages is ping flood. Using such packages, you can perform load testing of the channel or even turn off the Internet connection on one of the machines. But these functions can only be used with superuser rights. To organize ping flood, specify the -f option:

ping -f site

By default, in normal mode, each subsequent packet is sent when a response to the previous one is received. But you can set the interval between sending packets yourself -i:

ping -i 0.2 site

Here the ping program performs the so-called, customizable flood; you specify with what intensity the packets should be sent. With the -D option you can see the Unix Timestamp for each message:

ping -D site

Conclusions

In this article, we looked at what the ping command in Linux is, how to use it, its main parameters and application methods. This very simple tool can be used to test network problems and fix them. In this regard, the utility can become indispensable.

I have already written about, today I would like to focus your attention on the ping command. System administrators use the Ping command most often, although its potential is very limited. In this article I will tell you how to use the ping command and what problems it will help you solve.

Let's see what he can do Ping program, to do this, click start => run => type cmd => click OK => type the command in the black window

Ping /? => press enter.

You will see a list of commands that can be executed using the Ping program.

Ping [-t] [-a] [-n<число>] [-l<размер>] [-f] [-i ] [-v ] [-r<число>] [-s<число>] [[-j<список узлов>] | [-k<список узлов>]] [-w<тайм-аут>] [-R] [-S<адрес источника>] [-4] [-6] end_node Options -t Test communication with the specified node before terminating. To display statistics and continue checking, press the key combination CTRL+BREAK; To stop, press CTRL+C. -a Determine hostnames from addresses. -n<число>The number of echo requests sent. -l<размер>Send buffer size. -f Sets a flag in the packet that disables fragmentation (IPv4 only). -i Setting the packet lifetime. -v Set the service type (IPv4 only. This option is not available and does not affect the TOS field in the IP header). -r<число>Record a route for a specified number of hops (IPv4 only). -s<число>Timestamp for the specified number of hops (IPv4 only). -j<список_узлов>Free choice of route from a list of hosts (IPv4 only). -k<список_узлов>Hard route selection based on a list of hosts (IPv4 only). -w<тайм-аут>Timeout for each response (in milliseconds). -R Use the header to check the return route as well (IPv6 only). -S<адрес источника>The source address to use. -4 Forced use of IPv4 protocol. -6 Forced use of IPv6 protocol.

Let's look at some of them.

Practical use:

The t key is used when it is necessary to ping a resource for a long time, so as not to enter the command every time:

Ping site

can be entered like this:

Ping 27susday.ru -t

and the process can only be stopped manually by pressing ctrl+c

The i key is needed to set the lifetime of the sent packet, the default is 128. You send the packet and it starts searching through remote nodes, passing the node, one is subtracted, and so on until there is zero. Then the package is destroyed and displays a corresponding notification to you.

The w– key is needed to increase the waiting time for a response from the resource you are accessing. There are cases when you send a ping to a node, and it gives you a message that the specified node is not available, so you think that the node is down. The conclusion is correct, but not always. It happens that it is available, but it is overloaded and does not have time to answer you, to avoid this, the key w is set.

It happens that the remote node seems to be working, i.e. you can go to it, you are one hundred percent sure of its functionality, but it doesn’t respond to ping, even if you set a delay using the w key. This is explained by the fact that system administrator, set up a firewall and prohibited responding to ICMP packets. This is done so that it is impossible to storm servers that look on the Internet with echo requests. The server will not crash, but its performance will decrease.

Advice: If you are a novice system administrator, I advise you to close the ICMP port on your servers that access the Internet.

In this article you learned about the three main keys for the Ping program.

Video tutorial on reducing ping in games:

I think any administrator knows the ping command, which is used to check the availability of hosts. If you are an experienced administrator, you most likely won't learn anything new from this article. If your knowledge is limited to the banal ping ya.ru, I advise you to read the article to the end.

Example 1: Changing the time interval between sending packets

By default, packets are sent at intervals of one second. You can change this interval using the -i option.

Increasing interval

Example: Wait 5 seconds before sending the next packet.

$ ping -i 5 IP

Reducing the interval

Example: Wait 0.1 second before sending the next packet.

# ping -i 0.1 IP

Note: Only the superuser can specify an interval less than 0.2 seconds. Otherwise you will see a message like this.

$ ping -i 0.1 127.0.0.1 PING 0 (127.0.0.1) 56(84) bytes of data. ping: cannot flood; minimal interval, allowed for user, is 200ms

Example 2: Checking the local interface

Before checking the remote host, it is recommended to first check if everything is ok with your local interface. You can use the following 3 methods for this.

Ping zero (0)

This is the simplest and quick way:

$ ping 0 PING 0 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.024 ms ^C

Ping by name

$ ping localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.051 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.055 ms ^C --- localhost ping statistics -- - 2 packets transmitted, 2 received, 0% packet loss, time 999ms rtt min/avg/max/mdev = 0.051/0.053/0.055/0.002 ms

Ping via IP

$ ping 127.0.0.1 2 packets transmitted, 2 received, 0% packet loss time 999ms rtt min/avg/max/mdev = 0.051/0.053/0.055/0.002 ms

There should be no packet loss.

Example 3. Send N packets and exit

To automatically end ping after sending the number of packets you specify, use the -c option.

In the following example we will send 5 packets.

$ ping -c 5 google.com PING google.com (74.125.45.100) 56(84) bytes of data. 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=1 ttl=44 time=731 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=2 ttl =44 time=777 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=3 ttl=44 time=838 ms 64 bytes from yx-in-f100.google.com (74.125.45.100 ): icmp_seq=4 ttl=44 time=976 ms 64 bytes from yx-in-f100.google.com (74.125.45.100): icmp_seq=5 ttl=44 time=1071 ms --- google.com ping statistics -- - 5 packets transmitted, 5 received, 0% packet loss, time 4216ms rtt min/avg/max/mdev = 731.039/879.129/1071.050/126.625 ms

Example 4. Version of the ping command

Using the -V option we can view the current version of the command.

$ ping -V ping utility, iputils-sss20071127

Example 5. Flood on the network

The superuser can send thousands or more packets in a short time using the -f option.

As shown below, ping -f sent over 400,000 packets in a few seconds.

# ping -f localhost PING localhost (127.0.0.1) 56(84) bytes of data. .^C --- localhost ping statistics --- 427412 packets transmitted, 427412 received, 0% packet loss, time 10941ms rtt min/avg/max/mdev = 0.003/0.004/1.004/0.002 ms, ipg/ewma 0.025/0.004 ms

Example 6: Beep

This option is rarely used, but can be very useful. You start pinging, there is no response from the host, you figure out what's wrong, and as soon as the problem is resolved and the remote host responds, you will hear a sound.

$ ping -a IP

Example 7: Print only command execution statistics

Using the -q option, you can skip the responses from the remote host and display the resulting statistics directly.

$ ping -c 5 -q 127.0.0.1 PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. --- 127.0.0.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.047/0.053/0.061/0.009 ms

Example 8: Changing the batch size

You can change the size of the packet sent using the -s option.

Example: Let's change the packet size from 56 to 100.

$ ping -s 100 localhost PING localhost (127.0.0.1) 100(128) bytes of data. 108 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.022 ms 108 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.021 ms 108 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.020 ms ^C --- localhost ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 1998ms rtt min/avg/max/mdev = 0.020/0.021/0.022/ 0.000 ms

Example 9. Command execution duration

Using the -w option, we can specify the command execution time in seconds.

In the following example we will ping the localhost for 5 seconds.

$ ping -w 5 localhost

Note: If the -w and -c options are used simultaneously, the utility will terminate when the first constraint is triggered.

Example 10: Quick Statistics with SIGQUIT

Without interrupting the ping command, you can view execution statistics. To do this you need to click CTRL + |

$ ping -w 100 localhost PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=10 ttl=64 time=0.021 ms 64 bytes from localhost (127.0.0.1): icmp_seq=11 ttl=64 time=0.022 ms 11/11 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.024 ms 64 bytes from localhost (127.0.0.1): icmp_seq=12 ttl=64 time=0.021 ms 64 bytes from localhost (127.0.0.1): icmp_seq=13 ttl=64 time=0.022 ms 64 bytes from localhost (127.0.0.1): icmp_seq=14 ttl=64 time=0.021 ms 64 bytes from localhost (127.0.0.1): icmp_seq=15 ttl=64 time=0.021 ms 19/19 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.024 ms 64 bytes from localhost (127.0.0.1): icmp_seq=31 ttl=64 time=0.022 ms 64 bytes from localhost (127.0.0.1): icmp_seq=32 ttl=64 time=0.022 ms 32/32 packets, 0% loss, min/avg/ewma/max = 0.020/0.022/0.022/0.027 ms 64 bytes from localhost (127.0.0.1): icmp_seq=33 ttl=64 time=0.023 ms ..

The best tableware from world brands in the online store: BergHOFF, Luminarc, Vitesse

Team PING it is perhaps the most used command line network utility. PING present in all versions of all operating systems network-enabled and is a simple and convenient means of querying a host by name or IP address.

A special control message protocol is used to exchange service and diagnostic information on the network. ICMP(Internet Control Message Protocol). Team ping allows you to send a control message like Echo Request(type is 8 and is indicated in the ICMP message header) to the addressed node and interpret the response received from it in a form convenient for analysis. The data field of the sent icmp packet usually contains characters of the English alphabet. In response to such a request, the requested node must send an icmp packet with the same data that was received and the message type Echo Reply(the type code in the ICMP header is 0). If any problem occurs during the exchange of icmp messages, the ping utility will display information to diagnose it.

Command line format:

Ping [-t] [-a] [-n number] [-l size] [-f] [-i TTL] [-v TOS] [-r number] [-s number] [[-j Node list] | [-k Nodelist]] [-w timeout] finalName

Parameters:

-t- Continuous sending of packages. Keyboard combinations are used to complete and display statistics Ctrl+Break(statistics output and continuation), and Ctrl+C(statistics output and completion).
-a- Determining addresses by host names.
-n number- Number of echo requests sent.
-l size- Size of the data field in bytes of the sent request.
-f- Setting a flag that prohibits packet fragmentation.
-i TTL- Setting the lifetime of the package (the "Time To Live" field).
-v TOS- Specifying the type of service (field "Type Of Service").
-r number- Record a route for a specified number of hops.
-s number- Time stamp for the specified number of transitions.
-j listNodes- Free choice of route from a list of nodes.
-k listNodes- Hard route selection based on a list of nodes.
-w timeout- Maximum time to wait for each response in milliseconds.

Examples of use:

ping google.com- echo request to a node with name google.com with default parameters - the number of packets is 4, the length of the data array = 32 bytes.

ping -6 ya.ru- node ping ya.ru using IPv6 protocol

ping -a 192.168.1.50- perform a ping to determine the name of the terminal node by its address.

ping -s 192.168.0.1 computer- node ping computer from source 192.168.0.1. Used when the computer has several network interfaces.

ping w 5000 ya.ru- ping with a waiting timeout of 5 seconds (default - 4 seconds).

ping -n 5000 -l 1000 site- node polling website 5000 times, in packets with data 1000 bytes long. The allowed maximum data length is 65500.

ping -n 1 -l 3000 -f ya.ru- ping with packet fragmentation prohibited.

ping -n 1-r 3 ya.ru- send 1 echo request per node ya.ru with display of the first 3 transitions along the route.

ping -i 5 ya.ru- ping indicating lifetime TTL=5. If more hops along the route are required to reach the end node, the router that interrupted the delivery will respond with the message “Packet transmission time-to-live (TTL) exceeded.”

  • Using PING to step-by-step diagnose Internet access problems:
  • Generalized connection diagram for a computer (tablet, laptop) home network) with the end node removed can be represented as follows:

    The most common network with IP addresses 192.168.1.0 /255.255.255.0 is used as the home network. We are talking about IPv4 - IP protocol version 4, where 4 bytes are used for addressing. IP addresses It is customary to represent them as decimal byte values ​​separated by dots. Each device on the network must have its own unique address. In addition to the address, the network settings use mask network (subnet mask). The mask has the same format as the address. The combination of address and mask determines the range of addresses that belong to the local network - 192.168.1.0-192.168.1.255. The first and last addresses in the range are not assigned to individual network devices because they are used as the network address and broadcast address. Typically the router address is set to 192.168.1.1 or 192.168.1.254. This is not a mandatory standard, but is used quite often in practice. The one bits of the mask determine the permanent part of the network's IP address, and the zero bits are allocated to individual nodes. Meaning 255 is a byte with its bits set to one. The netmask serves as a means of determining the range of IP addresses belonging to the local network. Devices with such addresses are reachable locally, without using routing. Routing is a method of exchanging data with network devices that do not belong to a given local network through special device - router(router, router). Routers are specialized computers with multiple network interfaces and specialized software providing the forwarding of IP packets between the sender and recipient located on different networks. Several routers may participate in such forwarding, depending on the complexity of the route. A home router is the simplest type of router that forwards packets addressed to external networks to the next router in the provider’s network. The next router checks whether the end node's address is reachable locally, and either forwards the data to it or forwards it to the next router according to the route table. This happens until the data reaches the recipient or the packet's lifetime expires.

    The PING command can be used to diagnose individual nodes:

    ping 127.0.0.1- this is the ping of the loopback interface. Should run without errors if installed and in in working condition network software components.

    ping your IP or name- ping to your own address or name. Should complete without errors if all IP protocol software is installed and is working properly network adapter.

    ping router IP address- must be executed if it is working properly network card computer, the cable or wireless connection used to connect to the router is working, and the router itself is working. In addition, the IP settings must be such that the address of the computer and the router belong to the same subnet. This is usually the case when network settings are performed automatically using the router's DHCP server.

    ping yandex.ru- poll the node named yandex.ru. If the survey fails, the reason may be not only the lack of communication with the provider’s router, but also the inability to determine the node address yandex.ru due to problems with software name resolution.

    ping 8.8.8.8- poll the node with IP address 8.8.8.8. If polling by address is completed without errors, but polling by name ends with a message about an unknown host, then the problem is in name resolution. The reason may be that the provider's DNS server is not working. In this case, you can try changing it in the network connection settings to public DNS Google servers with addresses 8.8.4.4 and 8.8.8.8. Also, the problem may be caused by poor communication quality with the provider, which is accompanied by too long response times and packet drops.

    ping -t yandex.ru- perform ping before pressing the CTRL+C combination. When you press CTRL+Break, statistics are displayed and the node polling continues.

    Ping -n 1000 -l 500 192.168.1.1 - ping 1000 times using messages 500 bytes long. Pinging with packets of a standard length of 32 bytes can be performed without errors, but with long ones - with errors, which is typical for wireless connections with a low signal level in conditions of intense interference.

    Ping -n 1 -r 9 -w 1000 yandex.ru - perform ping 1 time (switch -n 1), issue a route for the first 9 hops (-r 9), wait for a response 1 second (1000ms)

    As a result of executing this command, the route trace is also displayed:

    Exchange of packages with yandex.ru with 32 bytes of data:
    Reply from 87.250.251.11: number of bytes=32 time=36ms TTL=54
    Route: 81.56.118.62 ->
    81.56.112.1 ->
    10.109.11.9 ->
    10.109.11.10 ->
    195.34.59.105 ->
    195.34.52.213 ->
    195.34.49.121 ->
    195.34.52.213 ->
    87.250.239.23

    Ping statistics for 87.250.251.11:

    Packets: sent = 1, received = 1, lost = 0
    (0% loss)
    Approximate round trip time in ms:
    Minimum = 36ms, Maximum = 36ms, Average = 36ms

    In this example, a chain of 9 routers is built between the sender and recipient of the packets. It is necessary to take into account the fact that in the version of the utility ping.exe for Windows, the number of transitions can take a value from 1 to 9. In cases where this value is not enough, the command is used tracert

    The absence of an echo response is not always a sign of a problem, since sometimes, for security reasons, some hosts are configured to ignore echo requests sent by PING. An example would be the node microsoft.com and some routers in small ISP networks.

    Using PING in batch files.

    Often, the PING command is used to organize delays in batch files. The loopback interface is pinged indicating the desired packet counter value specified by the parameter -n. Echo requests are sent at intervals of 1 second, and the response on the loopback interface arrives almost instantly, so the delay will be approximately equal to the counter minus one:

    ping -n 11 127.0.0.1- delay of 10 seconds.

    The PING command is used in batch files to determine the availability of IP addresses. Since the survey result is not reflected in any way in the ERRORLEVEL variable, instead of analyzing it, a search for certain characteristics is used in the PING standard output data. If you look closely at the messages from the ping.exe program when polling an accessible and inaccessible node, you will notice that they differ significantly

    ping 456.0.0.1- ping to a non-existent address

    The response to such a command may differ from the specific version of the utility, and may be something like this

    The ping failed to find host 456.0.0.1. Check the hostname and try again.

    ping yandex.ru- ping to the yandex.ru node address

    Response to ping of an accessible node:

    Exchange of packages with yandex.ru of 32 bytes:
    Reply from 87.250.250.11: number of bytes=32 time=10ms TTL=55

    Thus, to solve the problem of determining the availability of a node in a batch file, it is enough to analyze the characteristic words in the output of ping.exe upon a successful response. Most characteristic in this case is the presence of the word TTL. It is never encountered when an error occurs and consists only of characters from the English alphabet. To search for "TTL" in the results of ping.exe, it is most convenient to chain its execution with the command to search for a string of characters FIND.EXE(ping and find pipeline). If the text is found by the FIND command, then the value of the ERRORLEVEL variable will be equal to 0

    ping -n 1 COMPUTER | find /I "TTL" > nul
    if %ERRORLEVEL%==0 goto LIVE
    ECHO computer is not available
    unavailable state routine
    ...
    Exit
    :LIVE - start of the subroutine for processing the node's availability status
    ...
    ...

    In a simpler version, you can use the commands:

    PING yandex.ru |find "TTL=" && ECHO Yandex pingable- the ECHO command is executed if the ERRORLEVEL value set by FIND is 0, i.e. the node yandex.ru responds to ping.

    PING Server64 |find "TTL=" || ECHO Server64 not pingable- the ECHO command is executed if the ERRORLEVEL value set by FIND is not equal to 0, i.e. node Server64 did not respond to ping.


    Close