Assuming you have the target host name in a variable called 'host' then...
From the command line:
Code:
for /f "delims=[] tokens=2" %a in ('ping -n 1 %host% ^| findstr /i /c:"Pinging"') do @echo %host% %a>>IPs.txt
Or from a batch file:
Code:
for /f "delims=[] tokens=2" %%a in ('ping -n 1 %host% ^| findstr /i /c:"Pinging"') do @echo %host% %%a>>IPs.txt
Target hit?
JJ
[small][purple]Variables won't. Constants aren't[/purple]
There is no apostrophe in the plural of PC (or PST, or CPU, or HDD, or FDD, and so on)[/small]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.