Jump to content
Sign in to follow this  
Adrianvdh

Findstr

Recommended Posts

Hello everyone. I am wanting to ping a website with cmd. for example yotube.com...

 

 

Pinging youtube.com [173.194.34.66] with 32 bytes of data:
Reply from 173.194.34.66: bytes=32 time=184ms TTL=45
Reply from 173.194.34.66: bytes=32 time=241ms TTL=45
Reply from 173.194.34.66: bytes=32 time=198ms TTL=45
Reply from 173.194.34.66: bytes=32 time=223ms TTL=45

Ping statistics for 173.194.34.66:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 184ms, Maximum = 241ms, Average = 211ms

 

Ok and then I want to use the findstr command to get the IP address only and save it into a text file... it sould look like this

 

173.194.34.66 > atextfile.txt

 

But my only problem is my program doesnt know what the IP address is so i'm trying to extract t row of numbers like so 255.255.255.255 and that is the IP address.

 

I have only gotten this far

 

findstr /x "Ping statistics for [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" C:\Users\username\Desktop\IP.txt >>C:\Users\username\Desktop\data.txt

IF %ERRORLEVEL% EQU 0 (
echo You are winning
) else (
echo You are losing
)
pause
goto start

 

and it would only take the IP address and save it into a text file. Any Help would be nice :)
 

Edited by Adrianvdh

Share this post


Link to post
Share on other sites
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.