Skip to content

Instantly share code, notes, and snippets.

@g3rhard
Created June 21, 2017 09:36
Show Gist options
  • Save g3rhard/cc2291371001de46e909385af64da3a7 to your computer and use it in GitHub Desktop.
Save g3rhard/cc2291371001de46e909385af64da3a7 to your computer and use it in GitHub Desktop.
Bat script for reconnect VPN connection in Windows
@echo off
:loop
echo testing IP address
ping 123.456.78.90 >nul || (
echo ping failure - disconnecting
rasdial name_of_your_vpn_connect /disconnect
timeout /t 10 /nobreak
echo reconnecting
rasdial name_of_your_vpn_connect
timeout /t 10 /nobreak
)
timeout /t 30 /nobreak
goto :loop
@SourceSurfer
Copy link

@echo off
set VPNName="YourVPNConnectionName"

rasdial %VPNName%

@keshav225
Copy link

It works perfectly thank you @picolino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment