Link to home
Start Free TrialLog in
Avatar of waleedkk
waleedkk

asked on

Piping on DOS / Ping IP Addresses in Text File

Hi,

I am using Xp machine with SP2. I created a text file and filled it with IP addresses on each line. i want to ping these IPs one after the other not manually. I tried the following

(type ip.txt | ping) and it did not work!

would you please help?

Regards,  
ASKER CERTIFIED SOLUTION
Avatar of GuruGary
GuruGary
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I would suggest a few modifications though.

To only ping once, waiting for, at most .1 seconds to time out:
for /f "tokens=*" %a in (ip.txt) do ping -n 1 -w 100 %a

To only show responding IPs:
for /f "tokens=*" %a in (ip.txt) do ping -n 1 -w 100 %a|find /i "Reply"

And to ping an entire subnet:
for /l %a in (1,1,254) do ping -n 1 -w 100 192.168.1.%a|find /i "Reply"
Avatar of waleedkk
waleedkk

ASKER

Thanks guys this was quick. EE is my all-the-time place to gain knowledge.