Skip to content

Instantly share code, notes, and snippets.

@adrienne
Created May 23, 2012 09:39
Show Gist options
  • Save adrienne/2774271 to your computer and use it in GitHub Desktop.
Save adrienne/2774271 to your computer and use it in GitHub Desktop.
A batch file to connect to the VPN and mount the network storage as a drive
@echo off
if exist n:\home goto DISCONNECTME else goto CONNECTME
:CONNECTME
REM NOTE: in all of the below variables EXCEPT for mydrivename , double-quote the values!
REM This is the name of the VPN you've got set up
set myvpnname="Name of your VPN connection"
REM Your LDAP username and password
set myusername="username"
set mypassword="password"
REM The name of your CIFS instance, to use for mapping the drive
REM -- DO NOT QUOTE THIS VALUE!
set mydrivename=cifs##.bravo
rasdial %myvpnname% %myusername% %mypassword%
timeout 4
net use n: "\\%mydrivename%\public" %mypassword% /user:%myusername% /persistent:no
goto DONE
:DISCONNECTME
net use n: /delete
timeout 2
rasdial %myvpnname% /d
goto DONE
:DONE
@echo on
@hhhaiai
Copy link

hhhaiai commented Aug 22, 2016

有个问题。 你这里没办法设置 pptp方式还是其他方式

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