title: Extracting IP from ping into variable in bat script
body: <p>is there anyway i could do this? </p>
  
  <pre><code>@echo off
  REM #Testing FIND in IPCONFIG
  
  setlocal EnableDelayedExpansion
  
  for /f "tokens=3" %%a in ('ping localhost ^| findstr /i "reply"') do (
    set address=%%a
    set address=!address::=!
  )
  
  ipconfig /all | findstr %address%
  if ERRORLEVEL = 1 goto VIP_NOT_FOUND
  
  REM #We are here becuase the find returned a result.
  REM #It is safe to execute the rest of the application.
  REM #EXECUTES THE SCRIPT HERE
  
  echo "testing works" &gt;&gt; testing.txt
  
  :VIP_NOT_FOUND
  REM #This part of the script is where you would handle any
  REM #error logging or other admin related
  echo "Could not find a VIP. - Exiting"
  echo "end of script reached."
  </code></pre>
  
  <p>I am running this script on windows server 2k8 ENG version. It seems to keep on giving me findstr : bad command line. But i am not sure where the problem lies.</p>