Skip to content

Instantly share code, notes, and snippets.

@de1o
Created February 29, 2012 06:52
Show Gist options
  • Save de1o/1938647 to your computer and use it in GitHub Desktop.
Save de1o/1938647 to your computer and use it in GitHub Desktop.
a bat script to dial vpn on windows
; CMD: connect/disconnect vpn
#v::
run, "your directory\dialvpn.bat"
return
# Just a simple bat file for quickly dial vpn on Windows in Simplified Chinese.
# First of all, you should know how to use AHK.It's quite simple, check http://xbeta.info/autohotkey-guide-2.htm for a tutorial.
# To use the bat file:
# 1.For file "dialvpn.bat", replace the vpn_link_name with the vpn link name on you PC, and usrname, password is the account of your vpn service.
# 2.For file "AutoHotKey.ahk", replace the "your directory" with the directory where you put the dialvpn.bat. Then add these contents to the ahk script on your PC.
# Now press win+v to connect/disconnect your vpn.
# Notice: the dialvpn.bat file should encode by ANSI so that cmd can process the chinese word correctly.
@rasdial vps /disconnect|findstr 没有连接 >nul&&rasdial vps delo 123||echo 正在断开vpn...
@ping -n 2 127.0.0.1>nul
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment