Windows 7 is able to process all the commands from the previous versions of Windows, plus a few extra ones. Here is the VPN batch file I use all the time. Save it as c:\Tools\MyVPN.bat, then create two new Desktop shortcuts:
- Shortcut 1: c:\Tools\MyVPN.bat (to establish the VPN)
- Shortcut 2: c:\Tools\MyVPN.bat xxx (to kill the VPN)
@echo off
goto Start
Establish a VPN with xxx
Parameters: RDP - Start a Remote Desktop session
other - Disconnect an existing session
14.5.2010 FNL
:Start
net use /persistent:no
if not "%1"=="" (
net use * /d /y
rasdial /disconnect
echo Done!
ping localhost -n 2 > nul
goto :eof
)
set User=CRhoads
echo.
echo Creating a VPN under user %User%
rasdial VPNName %User% * /domain:xxx
/phonebook:"%UserProfile%\AppData\Roaming\Microsoft\Network\Connections\Pbk\rasphone.pbk"
if %ErrorLevel% EQU 0 (
net use K: \192.168.1.11\Data
net use L: \192.168.1.11\UserFiles
net use M: \192.168.1.11\HR
etc.
)
echo Done!
ping localhost -n 5 > nul
Note that the line above starting with the word "rasdial" is a very long line that ends with ".pbk". If it is broken up on your screen then you must rejoin it. Note also that you can remove the line "net use /persistent:no" after running the batch file for the first time.