Computing.Net > Forums > Networking > .bat file to ping ip range

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

.bat file to ping ip range

Reply to Message Icon

Name: Oranda
Date: June 27, 2003 at 12:32:25 Pacific
OS: Win2k
CPU/Ram: 1.8/512
Comment:

I am trying to make a bat file to run on a win2k pro machine that will ping an ip range (ie 192.168.10.1 - 192.168.10.254 and pipe the info to a text file. I had one years ago adn lost it. I can do it in a unix environment but having problems in the windows environment.



Sponsored Link
Ads by Google

Response Number 1
Name: ip256
Date: June 27, 2003 at 15:25:04 Pacific
Reply:

how about

ping -n 5 192.168.10.1 > ping.txt

-n 5 means ping the ip 5 times


0

Response Number 2
Name: Saleh
Date: June 28, 2003 at 04:19:27 Pacific
Reply:

Hi Oranda
i think this is what you are looking for!

Instead of manually pinging all IP addresses on your LAN you can use this nice command:

Open Command Prompt and type:

FOR /L %i IN (1,1,254) DO ping -n 1 192.168.0.%i | FIND /i "Reply">>c:\ipaddresses.txt

The "-n 1" is for only 1 ping packet to be sent to each computer.

Change 192.168.0 to match you own Network ID.

This will ping all IP addresses on the 192.168.0.0 network segment and create a text file called IPADDRESSES.TXT in C:\, where it will list only the IP addresses that gave a reply.

You can also add a -a to the PING command to resolve all the responding IP addresses to HOST names, but doing so will cause the script to take a considerable time to finish:

FOR /L %i IN (1,1,254) DO ping -a -n 1 192.168.0.%i | FIND /i "Reply">>c:\ipaddresses.txt

don't forget to type the command in 1 line.

Saleh



0

Response Number 3
Name: oranda
Date: June 30, 2003 at 13:19:36 Pacific
Reply:

Great thanks Saleh


0

Response Number 4
Name: oranda
Date: June 30, 2003 at 15:49:57 Pacific
Reply:

Now that I tried it, I am getting syntax errors. Any ideas?


0

Response Number 5
Name: hi
Date: July 1, 2003 at 11:22:32 Pacific
Reply:

no


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Networking Forum Home


Sponsored links

Ads by Google


Results for: .bat file to ping ip range

Batch file for ping ip www.computing.net/answers/networking/batch-file-for-ping-ip/35243.html

How to send a file to an IP www.computing.net/answers/networking/how-to-send-a-file-to-an-ip/17665.html

Creating a bat file pinging dns if www.computing.net/answers/networking/creating-a-bat-file-pinging-dns-if/36879.html