title: Latency detection using Batch Script
body: <p>I am making a batch script that detects High latency from a pinging reply and to notify me with my connection. My script detects 300ms to 700ms numbers by saving pinging reply to log file.</p>
  
  <pre><code>ping -n 15 192.206.238.4 | find /i "Reply" &gt; nul &gt; %cd%\acttracing.log
  </code></pre>
  
  <p>Then use findstr to search for 300ms to 700ms content and if thus it will go to :sound where it plays a warning notification. </p>
  
  <pre><code>nul findstr /c:"time=680" acttracing.log &amp;&amp; (
    echo "High Latency" was found.
  ) || (
    echo "High Latency" was NOT found.
  )
  If %ERRORLEVEL% equ 0 goto :sound
  
  nul findstr /c:"time=685" acttracing.log &amp;&amp; (
    echo "High Latency" was found.
  ) || (
    echo "High Latency" was NOT found.
  )
  If %ERRORLEVEL% equ 0 goto :sound
  
  nul findstr /c:"time=690" acttracing.log &amp;&amp; (
    echo "High Latency" was found.
  ) || (
    echo "High Latency" was NOT found.
  )
  If %ERRORLEVEL% equ 0 goto :sound
  
  nul findstr /c:"time=695" acttracing.log &amp;&amp; (
    echo "High Latency" was found.
  ) || (
    echo "High Latency" was NOT found.
  )
  If %ERRORLEVEL% equ 0 goto :sound
  
  nul findstr /c:"time=700" acttracing.log &amp;&amp; (
    echo "High Latency" was found.
  ) || (
    echo "High Latency" was NOT found.
  )
  If %ERRORLEVEL% equ 0 goto :sound
  </code></pre>
  
  <p>Now the problem, it's frequently notifying me even in one high latency number found from the saved log file which obviously not affecting my connection. How to make it go to :sound only if it detects 10 times ERRORLEVEL? is there a way to write my script shorter than writing it from 300 to 700?</p>
  
  <p>thanks in advance....</p>