Link to home
Start Free TrialLog in
Avatar of ZabagaR
ZabagaRFlag for United States of America

asked on

Batch script to parse list of IPs, ping then take action.

I have a text file of a few hundred IP addresses. I want to read each IP from the file.
After I obtain the IP, I'll ping the address.
If the ping result is a success I want to run a whole bunch of other batch commands (I've got about 10 lines of code) - then go to the next IP in the text file when done.
If the ping result is a failure, just go to the next IP on the list.

I think I'm better off not posting my current code that doesn't work! Thanks guys.
Avatar of SysExpert
SysExpert
Flag of Israel image

SOLUTION
Avatar of Qlemo
Qlemo
Flag of Germany 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
ASKER CERTIFIED SOLUTION
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
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
Avatar of ZabagaR

ASKER

SirBounty - that's the clearest answer for me. I actually was checking in to say I got the solution myself, similar to yours but instead of calling a local routine, I call another .bat and send my value to it as %1. I had already read 1 or 2 of the examples SysExpert sent - the first isn't any help but the last 2 are workable. But, I don't have a good understanding of the syntax. Same as Qlemo's input. I don't understand the double && or the use of the parenthesis. I'll have to look it up.

Thanks all !!  I really appreciate the quick replies. You guys and this site are great.