May 14

First you must create your VPN connection in Windows (XP, 2000 or later) using the standard wizard thingy Windows provides. Let’s say your connection is named “My vpn”.

I assumed that my intranet is giving me an address always starting with “192.168.100”  and I want to add route to 10.10.10.0/24 to my VPN gateway.

Now let’s start our script in a .bat file:

@rasdial /disconnect
@rasdial “My vpn” “MyUser” “MyPassword”
@setlocal
@for /f “tokens=1-2 delims=:” %%i in (‘ipconfig ^| find “IP Address” ^| find “192.168.100”‘) do set GETIP=%%j
@route add 10.10.10.0 mask 255.255.255.0 %GetIp%
@endlocal

After you’re done creating the .bat file, simply create a shortcut to it and put it on your desktop. This way you can doubleclick it, connect and start surfing your Intranet

written by MG \\ tags: ,