title: Batch script to tell if a website is up or down
body: <p>My issue is that ping doesn't tell me if the website is up or down. I need to know if the website is up or down. If it is not up restart the script. If anyone can help me out that would be amazing.</p>
  
  <p>The only thing I can think of is by grabbing the contents of the website and seeing if it is up or not.</p>
  
  <p>I want to run this on the server with Apatche Tomcat.</p>
  
  <pre><code>@echo off
  
  
  :first
  PING -n 5 google.com | FIND "TTL" &gt; nul
  IF %errorlevel% == 0 (
  echo Website is up. 
  goto :first
  ) ELSE (
  echo Website is down. Restarting service
  goto :second
  echo restart
  echo ping
  )
  
  
  :: This calls the second loop
  :second
  
  :: This will stop the service
  net stop TapiSrv 
  
  ping -n 10 127.0.0.1 
  
  :: This will start the service
  net start TapiSrv
  
  :: This check to see if the website is up
  GOTO :first
  </code></pre>