Skip to content

Instantly share code, notes, and snippets.

@ssttevee
Created January 17, 2019 03:35
Show Gist options
  • Select an option

  • Save ssttevee/6d485d56268bf9dcb0186bd34c1fefe8 to your computer and use it in GitHub Desktop.

Select an option

Save ssttevee/6d485d56268bf9dcb0186bd34c1fefe8 to your computer and use it in GitHub Desktop.
Windows batch script to connect to a VPN and add routes
@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