title: CMD Findstr with ping
body: <p>I am writting a batch file that pings a website, for example:</p>
  
  <pre><code>Pinging youtube.com [173.194.70.91] with 32 bytes of data:
  Reply from 173.194.70.91: bytes=32 time=187ms TTL=44
  
  Ping statistics for 173.194.70.91:
      Packets: Sent = 1, Received = 1, Lost = 0 (0% loss),
  Approximate round trip times in milli-seconds:
      Minimum = 187ms, Maximum = 187ms, Average = 187ms
  </code></pre>
  
  <p>and my program must copy just the IP address and save it into a text file.</p>
  
  <p>So it pings into a text file </p>
  
  <pre><code>ping youtube.com &gt;&gt; file.txt
  </code></pre>
  
  <p>Now I use the <code>findstr</code> command to find the IP address. And that's fine if I use this:</p>
  
  <pre><code>ping youtube.com -n 1 &gt;nul &gt;&gt;C:\Users\Adrian\Desktop\IP.txt
  findstr /i "Reply from 173.194.70.93: bytes=32 time=188ms TTL=43 C:\IP.txt
  
  IF %ERRORLEVEL% EQU 0 (
    echo You are winning
  ) else (
    echo You are losing
  )
  pause
  </code></pre>
  
  <p>Now it says I'm winning and thats a good thing but my program must find the IP address without knowing it. So the <code>findstr</code> command must know to get the IP address in between here...</p>
  
  <pre><code>"Reply from 173.194.70.91: bytes=32 time=187ms TTL=44"
  </code></pre>
  
  <p>so it must <code>findstr</code> the IP from that string. But I have been Googling and found nothing.</p>