Create a batch file to ping LAN IP Addresses

I am in need of a batch file to ping known IP addresses and find out if the IP addresses are valid on our network. I tried to create a simple batch file to test ping a few IPs but it did not work properly.

i.e.
ping 150.1.1.235
ping 150.1.1.248
ping  150.1.3.60
edrz01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pradeep DubeyConsultantCommented:
you can just copy below ping command and save as ping.bat, it will create a logfile in the C drive as pinglog.txt

run and give the output.

ping google.com >>c:\pinglog.txt

ping 150.1.1.235 >>c:\pinglog.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
edrz01Author Commented:
pradeep08_81 thank you.

Ironically, on the computer I am testing...I had to use the single '>' first to create the pinglog.txt and then the next IP Addresses I used the '>>' to append the file and Run As Administrator and create the file in a Temp folder. It would not allow me to write to the C root drive. Not sure why... double clicking on the batch file, it would hang...that's when I decided to Run as Administrator.

Nevertheless, thank you for your assistance.
0
Pradeep DubeyConsultantCommented:
Glad to help you!
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Steve KnightIT ConsultancyCommented:
Don't call it ping.bat btw... if you run "ping" inside it will run itself...

Also lots of other ways you can do this if needed, e.g. ping all hosts on a subnet with a one line batch file for command to loop, or ping a list of hosts etc.

Steve
0
edrz01Author Commented:
Steve, thank you for your input. Changing the name omitted the Run as Administrator.
0
Steve KnightIT ConsultancyCommented:
Erm, ok, if you say so!  Running "PING" inside a batch file called "PING" though will quite likely give you some interesting infinite loop effects at some point!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Legacy OS

From novice to tech pro — start learning today.