返回列表 发帖

[网络连接] 登录VPN后ADSL图标无法显示!依旧可以上网!

本帖最后由 65294060 于 2011-6-9 08:33 编辑

我在家用的是ADSL拨号,用了这个批处理后,在“网络连接”里的ADSL拨号没有了,但是还能上网。是什么原因?附上代码
@echo off & color 5a
reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters" /v "ProhibitIPSec" /t REG_DWORD /d 1 /f
(echo [VPN]
echo Encoding=1
echo Type=2
echo AutoLogon=0
echo UseRasCredentials=1
echo DialParamsUID=15526343
echo Guid=EE0684B33EC208418BFD034DFAE3D5F1
echo BaseProtocol=1
echo VpnStrategy=2
echo ExcludedProtocols=0
echo LcpExtensions=1
echo DataEncryption=256
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
echo RedialOnLinkFailure=0
echo CallbackMode=0
echo CustomDialDll=
echo CustomDialFunc=
echo CustomRasDialDll=
echo AuthenticateServer=0
echo ShareMsFilePrint=1
echo BindMsNetClient=1
echo SharedPhoneNumbers=0
echo GlobalDeviceSettings=0
echo PrerequisiteEntry=
echo PrerequisitePbk=
echo PreferredPort=VPN4-0
echo PreferredDevice=WAN 微型端口 (L2TP^)
echo PreferredBps=0
echo PreferredHwFlow=1
echo PreferredProtocol=1
echo PreferredCompression=1
echo PreferredSpeaker=1
echo PreferredMdmProtocol=0
echo PreviewUserPw=1
echo PreviewDomain=0
echo PreviewPhoneNumber=0
echo ShowDialingProgress=1
echo ShowMonitorIconInTaskBar=1
echo CustomAuthKey=-1
echo AuthRestrictions=608
echo TypicalAuth=2
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
echo IpNBTFlags=1
echo TcpWindowSize=0
echo UseFlags=0
echo IpSecFlags=0
echo IpDnsSuffix=
echo NETCOMPONENTS=
echo ms_server=1
echo ms_msclient=1
echo ms_psched=1
echo MEDIA=rastapi
echo Port=VPN4-0
echo Device=WAN 微型端口 (L2TP^)
echo DEVICE=vpn
echo PhoneNumber=119.60.0.66
echo AreaCode=
echo CountryCode=1
echo CountryID=1
echo UseDialingRules=0
echo Comment=
echo LastSelectedPhone=0
echo PromoteAlternates=0
echo TryNextAlternateOnFail=1)>%temp%\rasphone.pbk
copy /y %temp%\rasphone.pbk "%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk" >nul
(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 "VPN"
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 ws.sendkeys "VPN"
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%\rasphone.pbk %temp%\vpn.vbs >nul
echo.COPY
1

评分人数

    • batman: 感谢主动修改标题PB + 1

3# 65294060
。。。)>%temp%\rasphone.pbk
copy /y %temp%\rasphone.pbk "%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk" >nulCOPY
正常情况下你手工输入的新建网络连接信息记录在rasphone.pbk文件中,你用批处理写了rasphone.pbk,注册表中没有记录,所以能上网但不显示

TOP

1."ADSL拨号没有了"与"还能上网" 没有任何关系. 很多人用路由上网,并不需要PPPoE拨号.
  你还能上网因为你的PPPoE没断开, 重启后你就上不了了.
2."ADSL拨号没有了" 被替换了当然没了.  
    你把VPN追加进去而不是替换就可以了.
代码如下:
建立多个 VPN or PPPoE 连接
@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
rem 使用RAS的全权证书
if "%linkType%"=="1" (echo UseRasCredentials=1) else (echo UseRasCredentials=0)
rem ★拨号参数的UID
echo DialParamsUID=15526343
if "%linkType%"=="1" (echo Guid=EE0684B33EC208418BFD034DFAE3D5F1) else (echo Guid=634FB3A1DDF5D14F9A87795DF822D9D0)
echo BaseProtocol=1
rem VPN类型:,PPPoE=0
if "%linkType%"=="1" (echo VpnStrategy=2) else (echo VpnStrategy=0)
rem ;排除协议
if "%linkType%"=="1" (echo ExcludedProtocols=0) else (echo ExcludedProtocols=3)
echo LcpExtensions=1
rem 数据加密
if "%linkType%"=="1" (echo DataEncryption=256) else (echo DataEncryption=8)
rem 压缩
echo SwCompression=1
rem 始终协商多重链接
echo NegotiateMultilinkAlways=0
echo SkipNwcWarning=0
rem 跳过下层对话
echo SkipDownLevelDialog=0
rem 跳过双拨号对话框
echo SkipDoubleDialDialog=0
rem 拨号方式
echo DialMode=1
rem 拨号百分率
echo DialPercent=75
echo DialSeconds=120
rem 挂断百分率
echo HangUpPercent=10
echo HangUpSeconds=120
echo OverridePref=15
rem 重拨次数
echo RedialAttempts=3
rem 重拨间隔(秒)
echo RedialSeconds=60
rem 空闲断开(秒)
echo IdleDisconnectSeconds=0
rem 断线重拨
if "%linkType%"=="1" (echo RedialOnLinkFailure=0) else (echo RedialOnLinkFailure=1)
rem 回拨模式
echo CallbackMode=0
rem 自定义拨号的dll文件
echo CustomDialDll=
rem 自定义拨号的dll文件中函数
echo CustomDialFunc=
rem 自定义的Dll RAS拨入
echo CustomRasDialDll=
rem 验证服务器
echo AuthenticateServer=0
rem 文件打印共享 0/1 VPN=1 PPPoE=0
if "%linkType%"=="1" (echo ShareMsFilePrint=1) else (echo ShareMsFilePrint=0)
rem Net客户机绑定 0/1 VPN=1 PPPoE=0
if "%linkType%"=="1" (echo BindMsNetClient=1) else (echo BindMsNetClient=0)
rem 电话号码共享
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
rem 显示拨号进展
echo ShowDialingProgress=1
rem 显示任务栏图标
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)
rem 目标IP
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
“阿姐走了。。。可是。。。我。。。我愿意。”

TOP

这是怎么回事呢?

TOP

************************************************************

  对不起,本贴因为标题过于模糊或含有敏感字符而触犯版规!请
楼主在仔细阅读论坛发贴规则后主动修改好标题。同时本贴将暂时禁
止回复,对于因此而给楼主带来的不便我们深表歉意,但也请楼主自
觉遵守和维护论坛秩序,谢谢!

请阅读论坛发贴规则:http://www.bathome.net/thread-963-1-1.html

提示:
        请大家在楼主修改标题并得到管理层认可之前不要给出任何有意义的回复。
        否则一律视为无视论坛纪律扣2分!(管理层和技术组扣4分)
        论坛是大家的,也要靠大家来维护。。。


************************************************************
***共同提高***

TOP

返回列表