title: Using a BAT file to automatically reconnect a VPN Cisco on failure of connection
body: <p>I would like help to create an automatic BAT script that reconnects my Cisco VPN Client Session in case of outage of Internet. </p>
  
  <p>There are two command lines: <code>command 1</code> to connect and <code>command 2</code> to disconnect. </p>
  
  <p>To monitor the connection I would like use ICMP (Like <code>5 failed pings</code>) and if working VPN then continue to forward data. If not use <code>command 2</code> to disconnect the VPN Session and try to reconnect again.</p>
  
  <p>If possible I would like it to loop so it will auto-reconnect every time the WAN Link breaks.</p>
  
  <p><strong>command 1</strong>: The Client program is at:  <code>C:\Program Files (x86)\Cisco Systems\VPN</code></p>
  
  <pre><code>start vpnclient connect rcx user TESTE pwd TESTE stdin
  </code></pre>
  
  <p><strong>command 2</strong>: The Client program is at: <code>C:\Program Files (x86)\Cisco Systems\VPN</code></p>
  
  <pre><code>vpnclient disconnect
  </code></pre>
  
  <p>I made many attempts with no success. </p>