troubleshooting Question

ping and output a list of ip's

Avatar of AlfonsoPina
AlfonsoPina asked on
Microsoft DOSWindows OS
5 Comments1 Solution947 ViewsLast Modified:
I need something fairly simple, I just need to ping a list of computers on my text file (printers.txt) with a -a argument to resolve the hostname. then output that to a simple text file, output.txt

I have tried the following but the result was that I had 4k instances of cmd.exe in my processes.

@echo off

type nul>pass.txt

type nul>fail.txt

for /f %%a in (printers.txt) do call :ping %%a

goto :EOF


echo testing %1

ping %1|find /i "TTL=">nul

if %errorlevel%==0 echo pass&echo %1>>pass.txt

if %errorlevel%==1 echo FAIL&echo %1>>fail.txt

again, I ended up with about 4k instances of cmd.exe and find.exe (a grep instance of some sort).

I'm not real smart but I would like some assistance on this. I just want a very simple ping -a and output to a text or.csv file.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros