| @echo off |
| reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters" /v "ProhibitIPSec" /t REG_DWORD /d 1 /f |
| set "pbkPath=%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk" |
| if not exist "%pbkPath%\rasphone.pbk.txt" copy "%pbkPath%\rasphone.pbk" "%pbkPath%\rasphone.pbk.txt" |
| cd.>"%pbkPath%\rasphone.pbk" |
| echo 建立多个 VPN or PPPoE 连接 |
| :start ============================================================ |
| set /p "linkType=连接类型:VPN or PPPoE(1/2/q):" |
| if /i "%linkType%"=="q" goto end |
| echo %linkType%|findstr "^[12]$">nul 2>nul||goto:start |
| set "linkName="&set /p "linkName=连接名称:" |
| if not defined linkName (if "%linkType%"=="1" (set "linkName=VPN") else (set "linkName=PPPoE")) |
| @echo off |
| (echo [%linkName%] |
| echo Encoding=1 |
| if "%linkType%"=="1" (echo Type=2) else (echo Type=5) |
| echo AutoLogon=0 |
| |
| if "%linkType%"=="1" (echo UseRasCredentials=1) else (echo UseRasCredentials=0) |
| |
| echo DialParamsUID=15526343 |
| if "%linkType%"=="1" (echo Guid=EE0684B33EC208418BFD034DFAE3D5F1) else (echo Guid=634FB3A1DDF5D14F9A87795DF822D9D0) |
| echo BaseProtocol=1 |
| |
| if "%linkType%"=="1" (echo VpnStrategy=2) else (echo VpnStrategy=0) |
| |
| if "%linkType%"=="1" (echo ExcludedProtocols=0) else (echo ExcludedProtocols=3) |
| echo LcpExtensions=1 |
| |
| if "%linkType%"=="1" (echo DataEncryption=256) else (echo DataEncryption=8) |
| |
| echo SwCompression=1 |
| |
| echo NegotiateMultilinkAlways=0 |
| echo SkipNwcWarning=0 |
| |
| echo SkipDownLevelDialog=0 |
| |
| echo SkipDoubleDialDialog=0 |
| |
| echo DialMode=1 |
| |
| echo DialPercent=75 |
| echo DialSeconds=120 |
| |
| echo HangUpPercent=10 |
| echo HangUpSeconds=120 |
| echo OverridePref=15 |
| |
| echo RedialAttempts=3 |
| |
| echo RedialSeconds=60 |
| |
| echo IdleDisconnectSeconds=0 |
| |
| if "%linkType%"=="1" (echo RedialOnLinkFailure=0) else (echo RedialOnLinkFailure=1) |
| |
| echo CallbackMode=0 |
| |
| echo CustomDialDll= |
| |
| echo CustomDialFunc= |
| |
| echo CustomRasDialDll= |
| |
| echo AuthenticateServer=0 |
| |
| if "%linkType%"=="1" (echo ShareMsFilePrint=1) else (echo ShareMsFilePrint=0) |
| |
| if "%linkType%"=="1" (echo BindMsNetClient=1) else (echo BindMsNetClient=0) |
| |
| echo SharedPhoneNumbers=0 |
| echo GlobalDeviceSettings=0 |
| echo PrerequisiteEntry= |
| echo PrerequisitePbk= |
| if "%linkType%"=="1" (echo PreferredPort=VPN4-0) else (echo PreferredPort^=) |
| if "%linkType%"=="1" (echo PreferredDevice=WAN 微型端口 ^(L2TP^)) else (echo PreferredDevice^=) |
| echo PreferredBps=0 |
| if "%linkType%"=="1" (echo PreferredHwFlow=1) else (echo PreferredHwFlow=0) |
| if "%linkType%"=="1" (echo PreferredProtocol=1) else (echo PreferredProtocol=0) |
| if "%linkType%"=="1" (echo PreferredCompression=1) else (echo PreferredCompression=0) |
| if "%linkType%"=="1" (echo PreferredSpeaker=1) else (echo PreferredSpeaker=0) |
| echo PreferredMdmProtocol=0 |
| echo PreviewUserPw=1 |
| echo PreviewDomain=0 |
| echo PreviewPhoneNumber=0 |
| |
| echo ShowDialingProgress=1 |
| |
| echo ShowMonitorIconInTaskBar=1 |
| echo CustomAuthKey=-1 |
| if "%linkType%"=="1" (echo AuthRestrictions=608) else (echo AuthRestrictions=632) |
| if "%linkType%"=="1" (echo TypicalAuth=2) else (echo TypicalAuth=1) |
| echo IpPrioritizeRemote=1 |
| echo IpHeaderCompression=0 |
| echo IpAddress=0.0.0.0 |
| echo IpDnsAddress=0.0.0.0 |
| echo IpDns2Address=0.0.0.0 |
| echo IpWinsAddress=0.0.0.0 |
| echo IpWins2Address=0.0.0.0 |
| echo IpAssign=1 |
| echo IpNameAssign=1 |
| echo IpFrameSize=1006 |
| echo IpDnsFlags=0 |
| if "%linkType%"=="1" (echo IpNBTFlags=1) else (echo IpNBTFlags=0) |
| echo TcpWindowSize=0 |
| if "%linkType%"=="1" (echo UseFlags=0) else (echo UseFlags=1) |
| echo IpSecFlags=0 |
| echo IpDnsSuffix= |
| echo. |
| echo NETCOMPONENTS= |
| if "%linkType%"=="1" (echo ms_server=1) else (echo ms_server=0) |
| if "%linkType%"=="1" (echo ms_msclient=1) else (echo ms_msclient=0) |
| if "%linkType%"=="1" (echo ms_psched=1) |
| echo. |
| echo MEDIA=rastapi |
| if "%linkType%"=="1" (echo Port=VPN4-0) else (echo Port=PPPoE6-0) |
| if "%linkType%"=="1" (echo Device=WAN 微型端口 ^(L2TP^)) else (echo Device=WAN 微型端口 ^(PPPOE^)) |
| echo. |
| if "%linkType%"=="1" (echo DEVICE=vpn) else (echo DEVICE=PPPoE) |
| |
| if "%linkType%"=="1" (echo PhoneNumber=119.60.0.66) else (echo PhoneNumber=) |
| echo AreaCode= |
| echo CountryCode=1 |
| echo CountryID=1 |
| echo UseDialingRules=0 |
| echo Comment= |
| echo LastSelectedPhone=0 |
| echo PromoteAlternates=0 |
| echo TryNextAlternateOnFail=1 |
| echo. |
| )>>"%pbkPath%\rasphone.pbk" |
| @echo off |
| |
| (echo set ws=createobject("wscript.shell"^) |
| echo ws.run "cmd /c ncpa.cpl",0 |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{f5}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "%linkName%" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "%%{f}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{R}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{Tab}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{D}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "^+{Tab}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "^+{Tab}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "^+{Tab}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{D}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{ENTER}" |
| echo ws.run "cmd /c ncpa.cpl",0 |
| echo wscript.sleep 1000 |
| echo ws.sendkeys "{f5}" |
| echo wscript.sleep 1000 |
| echo 创建快捷方式:"%linkName%">con |
| echo ws.sendkeys "%linkName%" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "%%{f}" |
| echo wscript.sleep 500 |
| echo ws.sendkeys "{s}" |
| echo wscript.sleep 300 |
| echo ws.sendkeys "{y}" |
| echo wscript.sleep 300 |
| echo ws.sendkeys "%%{f4}")>%temp%\vpn.vbs |
| start /wait %temp%\vpn.vbs |
| ::del /f /q "%temp%\vpn.vbs" >nul |
| echo. |
| goto:start |
| :end ============================================================== |
| echo 按任意键退出&pause>nul |
| exit/bCOPY |