Created
January 17, 2019 03:35
-
-
Save ssttevee/6d485d56268bf9dcb0186bd34c1fefe8 to your computer and use it in GitHub Desktop.
Windows batch script to connect to a VPN and add routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| setlocal | |
| set VPN_NAME=My VPN | |
| rasphone -d "%VPN_NAME%" | |
| rem find the interface id | |
| for /f "delims=." %%i in ('route print ^| findstr "%VPN_NAME%"') do set IF_NUM=%%i | |
| route ADD 192.168.1.0 MASK 255.255.255.0 192.168.1.1 IF %IF_NUM% | |
| endlocal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment