Received: from elementktips.com (elementktips.com [204.255.225.34] (may be forged))

Received: from tips (helo=localhost)
by elementktips.com with local-smtp (Exim 2.05 #1)
id 12z4UI-0003SI-00; Mon, 5 Jun 2000 17:32:46 -0400
Received: by mail.elementktips.com (ZDTips_Mailer v1.5); Mon, 5 Jun 2000 17:30:36 -0400
Subject: EWNTips: Pinging multiple computers simultaneously
From: [email protected]
To: [email protected]
Message-ID:
Date: Mon, 5 Jun 2000 17:32:46 -0400


Pinging multiple computers simultaneously

As an administrator of a TCP/IP-based network, on occasion you might find it
necessary to ping several computers on your network. For example, you might
want to ping multiple computers in order to identify which IP addresses are
currently in use. An easy way to ping multiple computers on the same subnet
is to use the FOR command. Consider the following command:

FOR /L %g IN (1,1,254) DO ping -n 2 200.200.200.%g

In English, this command states that we want to "do" the ping command as long
as the %g variable is within the range from 1 to 254. We specify the range for
%g by using the syntax (start, step, end). Start indicates the starting value
for %g (1 in this example), step indicates the number with which we want to
increment %g (1 in our example), and end indicates the number at which we want
to stop pinging. We've also limited the number of pings to 2 by using -n 2
(instead of the typical 4 for each computer.

When you run this command, you'll see that your computer pings the following
IP addresses:

200.200.200.1
200.200.200.2
200.200.200.3
...
200.200.200.254

This tip was contributed by Rafael Sanchez, [email protected].