[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

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

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

我在家用的是ADSL拨号,用了这个批处理后,在“网络连接”里的ADSL拨号没有了,但是还能上网。是什么原因?附上代码
  1. @echo off & color 5a
  2. reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters" /v "ProhibitIPSec" /t REG_DWORD /d 1 /f
  3. (echo [VPN]
  4. echo Encoding=1
  5. echo Type=2
  6. echo AutoLogon=0
  7. echo UseRasCredentials=1
  8. echo DialParamsUID=15526343
  9. echo Guid=EE0684B33EC208418BFD034DFAE3D5F1
  10. echo BaseProtocol=1
  11. echo VpnStrategy=2
  12. echo ExcludedProtocols=0
  13. echo LcpExtensions=1
  14. echo DataEncryption=256
  15. echo SwCompression=1
  16. echo NegotiateMultilinkAlways=0
  17. echo SkipNwcWarning=0
  18. echo SkipDownLevelDialog=0
  19. echo SkipDoubleDialDialog=0
  20. echo DialMode=1
  21. echo DialPercent=75
  22. echo DialSeconds=120
  23. echo HangUpPercent=10
  24. echo HangUpSeconds=120
  25. echo OverridePref=15
  26. echo RedialAttempts=3
  27. echo RedialSeconds=60
  28. echo IdleDisconnectSeconds=0
  29. echo RedialOnLinkFailure=0
  30. echo CallbackMode=0
  31. echo CustomDialDll=
  32. echo CustomDialFunc=
  33. echo CustomRasDialDll=
  34. echo AuthenticateServer=0
  35. echo ShareMsFilePrint=1
  36. echo BindMsNetClient=1
  37. echo SharedPhoneNumbers=0
  38. echo GlobalDeviceSettings=0
  39. echo PrerequisiteEntry=
  40. echo PrerequisitePbk=
  41. echo PreferredPort=VPN4-0
  42. echo PreferredDevice=WAN 微型端口 (L2TP^)
  43. echo PreferredBps=0
  44. echo PreferredHwFlow=1
  45. echo PreferredProtocol=1
  46. echo PreferredCompression=1
  47. echo PreferredSpeaker=1
  48. echo PreferredMdmProtocol=0
  49. echo PreviewUserPw=1
  50. echo PreviewDomain=0
  51. echo PreviewPhoneNumber=0
  52. echo ShowDialingProgress=1
  53. echo ShowMonitorIconInTaskBar=1
  54. echo CustomAuthKey=-1
  55. echo AuthRestrictions=608
  56. echo TypicalAuth=2
  57. echo IpPrioritizeRemote=1
  58. echo IpHeaderCompression=0
  59. echo IpAddress=0.0.0.0
  60. echo IpDnsAddress=0.0.0.0
  61. echo IpDns2Address=0.0.0.0
  62. echo IpWinsAddress=0.0.0.0
  63. echo IpWins2Address=0.0.0.0
  64. echo IpAssign=1
  65. echo IpNameAssign=1
  66. echo IpFrameSize=1006
  67. echo IpDnsFlags=0
  68. echo IpNBTFlags=1
  69. echo TcpWindowSize=0
  70. echo UseFlags=0
  71. echo IpSecFlags=0
  72. echo IpDnsSuffix=
  73. echo NETCOMPONENTS=
  74. echo ms_server=1
  75. echo ms_msclient=1
  76. echo ms_psched=1
  77. echo MEDIA=rastapi
  78. echo Port=VPN4-0
  79. echo Device=WAN 微型端口 (L2TP^)
  80. echo DEVICE=vpn
  81. echo PhoneNumber=119.60.0.66
  82. echo AreaCode=
  83. echo CountryCode=1
  84. echo CountryID=1
  85. echo UseDialingRules=0
  86. echo Comment=
  87. echo LastSelectedPhone=0
  88. echo PromoteAlternates=0
  89. echo TryNextAlternateOnFail=1)>%temp%\rasphone.pbk
  90. copy /y %temp%\rasphone.pbk "%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk\rasphone.pbk" >nul
  91. (echo set ws=createobject("wscript.shell"^)
  92. echo ws.run "cmd /c ncpa.cpl",0
  93. echo wscript.sleep 500
  94. echo ws.sendkeys "{f5}"
  95. echo wscript.sleep 500
  96. echo ws.sendkeys "VPN"
  97. echo wscript.sleep 500
  98. echo ws.sendkeys "%%{f}"
  99. echo wscript.sleep 500
  100. echo ws.sendkeys "{R}"
  101. echo wscript.sleep 500
  102. echo ws.sendkeys "{Tab}"
  103. echo wscript.sleep 500
  104. echo ws.sendkeys "{D}"
  105. echo wscript.sleep 500
  106. echo ws.sendkeys "^+{Tab}"
  107. echo wscript.sleep 500
  108. echo ws.sendkeys "^+{Tab}"
  109. echo wscript.sleep 500
  110. echo ws.sendkeys "^+{Tab}"
  111. echo wscript.sleep 500
  112. echo ws.sendkeys "{D}"
  113. echo wscript.sleep 500
  114. echo ws.sendkeys "{ENTER}"
  115. echo ws.run "cmd /c ncpa.cpl",0
  116. echo wscript.sleep 1000
  117. echo ws.sendkeys "{f5}"
  118. echo wscript.sleep 1000
  119. echo ws.sendkeys "VPN"
  120. echo wscript.sleep 500
  121. echo ws.sendkeys "%%{f}"
  122. echo wscript.sleep 500
  123. echo ws.sendkeys "{s}"
  124. echo wscript.sleep 300
  125. echo ws.sendkeys "{y}"
  126. echo wscript.sleep 300
  127. echo ws.sendkeys "%%{f4}")>%temp%\vpn.vbs
  128. start /wait %temp%\vpn.vbs
  129. del /f /q %temp%\rasphone.pbk %temp%\vpn.vbs >nul
  130. echo.
复制代码
1

评分人数

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

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

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

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

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


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

TOP

这是怎么回事呢?

TOP

1."ADSL拨号没有了"与"还能上网" 没有任何关系. 很多人用路由上网,并不需要PPPoE拨号.
  你还能上网因为你的PPPoE没断开, 重启后你就上不了了.
2."ADSL拨号没有了" 被替换了当然没了.  
    你把VPN追加进去而不是替换就可以了.
代码如下:
建立多个 VPN or PPPoE 连接
  1. @echo off
  2. reg add "HKLM\SYSTEM\CurrentControlSet\Services\RasMan\Parameters" /v "ProhibitIPSec" /t REG_DWORD /d 1 /f
  3. set "pbkPath=%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk"
  4. if not exist "%pbkPath%\rasphone.pbk.txt" copy "%pbkPath%\rasphone.pbk" "%pbkPath%\rasphone.pbk.txt"
  5. cd.>"%pbkPath%\rasphone.pbk"
  6. echo 建立多个 VPN or PPPoE 连接
  7. :start ============================================================
  8. set /p "linkType=连接类型:VPN or PPPoE(1/2/q):"
  9. if /i "%linkType%"=="q" goto end
  10. echo %linkType%|findstr "^[12]$">nul 2>nul||goto:start
  11. set "linkName="&set /p "linkName=连接名称:"
  12. if not defined linkName (if "%linkType%"=="1" (set "linkName=VPN") else (set "linkName=PPPoE"))
  13. @echo off
  14. (echo [%linkName%]
  15. echo Encoding=1
  16. if "%linkType%"=="1" (echo Type=2) else (echo Type=5)
  17. echo AutoLogon=0
  18. rem 使用RAS的全权证书
  19. if "%linkType%"=="1" (echo UseRasCredentials=1) else (echo UseRasCredentials=0)
  20. rem ★拨号参数的UID
  21. echo DialParamsUID=15526343
  22. if "%linkType%"=="1" (echo Guid=EE0684B33EC208418BFD034DFAE3D5F1) else (echo Guid=634FB3A1DDF5D14F9A87795DF822D9D0)
  23. echo BaseProtocol=1
  24. rem VPN类型:,PPPoE=0
  25. if "%linkType%"=="1" (echo VpnStrategy=2) else (echo VpnStrategy=0)
  26. rem ;排除协议
  27. if "%linkType%"=="1" (echo ExcludedProtocols=0) else (echo ExcludedProtocols=3)
  28. echo LcpExtensions=1
  29. rem 数据加密
  30. if "%linkType%"=="1" (echo DataEncryption=256) else (echo DataEncryption=8)
  31. rem 压缩
  32. echo SwCompression=1
  33. rem 始终协商多重链接
  34. echo NegotiateMultilinkAlways=0
  35. echo SkipNwcWarning=0
  36. rem 跳过下层对话
  37. echo SkipDownLevelDialog=0
  38. rem 跳过双拨号对话框
  39. echo SkipDoubleDialDialog=0
  40. rem 拨号方式
  41. echo DialMode=1
  42. rem 拨号百分率
  43. echo DialPercent=75
  44. echo DialSeconds=120
  45. rem 挂断百分率
  46. echo HangUpPercent=10
  47. echo HangUpSeconds=120
  48. echo OverridePref=15
  49. rem 重拨次数
  50. echo RedialAttempts=3
  51. rem 重拨间隔(秒)
  52. echo RedialSeconds=60
  53. rem 空闲断开(秒)
  54. echo IdleDisconnectSeconds=0
  55. rem 断线重拨
  56. if "%linkType%"=="1" (echo RedialOnLinkFailure=0) else (echo RedialOnLinkFailure=1)
  57. rem 回拨模式
  58. echo CallbackMode=0
  59. rem 自定义拨号的dll文件
  60. echo CustomDialDll=
  61. rem 自定义拨号的dll文件中函数
  62. echo CustomDialFunc=
  63. rem 自定义的Dll RAS拨入
  64. echo CustomRasDialDll=
  65. rem 验证服务器
  66. echo AuthenticateServer=0
  67. rem 文件打印共享 0/1 VPN=1 PPPoE=0
  68. if "%linkType%"=="1" (echo ShareMsFilePrint=1) else (echo ShareMsFilePrint=0)
  69. rem Net客户机绑定 0/1 VPN=1 PPPoE=0
  70. if "%linkType%"=="1" (echo BindMsNetClient=1) else (echo BindMsNetClient=0)
  71. rem 电话号码共享
  72. echo SharedPhoneNumbers=0
  73. echo GlobalDeviceSettings=0
  74. echo PrerequisiteEntry=
  75. echo PrerequisitePbk=
  76. if "%linkType%"=="1" (echo PreferredPort=VPN4-0) else (echo PreferredPort^=)
  77. if "%linkType%"=="1" (echo PreferredDevice=WAN 微型端口 ^(L2TP^)) else (echo PreferredDevice^=)
  78. echo PreferredBps=0
  79. if "%linkType%"=="1" (echo PreferredHwFlow=1) else (echo PreferredHwFlow=0)
  80. if "%linkType%"=="1" (echo PreferredProtocol=1) else (echo PreferredProtocol=0)
  81. if "%linkType%"=="1" (echo PreferredCompression=1) else (echo PreferredCompression=0)
  82. if "%linkType%"=="1" (echo PreferredSpeaker=1) else (echo PreferredSpeaker=0)
  83. echo PreferredMdmProtocol=0
  84. echo PreviewUserPw=1
  85. echo PreviewDomain=0
  86. echo PreviewPhoneNumber=0
  87. rem 显示拨号进展
  88. echo ShowDialingProgress=1
  89. rem 显示任务栏图标
  90. echo ShowMonitorIconInTaskBar=1
  91. echo CustomAuthKey=-1
  92. if "%linkType%"=="1" (echo AuthRestrictions=608) else (echo AuthRestrictions=632)
  93. if "%linkType%"=="1" (echo TypicalAuth=2) else (echo TypicalAuth=1)
  94. echo IpPrioritizeRemote=1
  95. echo IpHeaderCompression=0
  96. echo IpAddress=0.0.0.0
  97. echo IpDnsAddress=0.0.0.0
  98. echo IpDns2Address=0.0.0.0
  99. echo IpWinsAddress=0.0.0.0
  100. echo IpWins2Address=0.0.0.0
  101. echo IpAssign=1
  102. echo IpNameAssign=1
  103. echo IpFrameSize=1006
  104. echo IpDnsFlags=0
  105. if "%linkType%"=="1" (echo IpNBTFlags=1) else (echo IpNBTFlags=0)
  106. echo TcpWindowSize=0
  107. if "%linkType%"=="1" (echo UseFlags=0) else (echo UseFlags=1)
  108. echo IpSecFlags=0
  109. echo IpDnsSuffix=
  110. echo.
  111. echo NETCOMPONENTS=
  112. if "%linkType%"=="1" (echo ms_server=1) else (echo ms_server=0)
  113. if "%linkType%"=="1" (echo ms_msclient=1) else (echo ms_msclient=0)
  114. if "%linkType%"=="1" (echo ms_psched=1)
  115. echo.
  116. echo MEDIA=rastapi
  117. if "%linkType%"=="1" (echo Port=VPN4-0) else (echo Port=PPPoE6-0)
  118. if "%linkType%"=="1" (echo Device=WAN 微型端口 ^(L2TP^)) else (echo Device=WAN 微型端口 ^(PPPOE^))
  119. echo.
  120. if "%linkType%"=="1" (echo DEVICE=vpn) else (echo DEVICE=PPPoE)
  121. rem 目标IP
  122. if "%linkType%"=="1" (echo PhoneNumber=119.60.0.66) else (echo PhoneNumber=)
  123. echo AreaCode=
  124. echo CountryCode=1
  125. echo CountryID=1
  126. echo UseDialingRules=0
  127. echo Comment=
  128. echo LastSelectedPhone=0
  129. echo PromoteAlternates=0
  130. echo TryNextAlternateOnFail=1
  131. echo.
  132. )>>"%pbkPath%\rasphone.pbk"
  133. @echo off
  134. (echo set ws=createobject("wscript.shell"^)
  135. echo ws.run "cmd /c ncpa.cpl",0
  136. echo wscript.sleep 500
  137. echo ws.sendkeys "{f5}"
  138. echo wscript.sleep 500
  139. echo ws.sendkeys "%linkName%"
  140. echo wscript.sleep 500
  141. echo ws.sendkeys "%%{f}"
  142. echo wscript.sleep 500
  143. echo ws.sendkeys "{R}"
  144. echo wscript.sleep 500
  145. echo ws.sendkeys "{Tab}"
  146. echo wscript.sleep 500
  147. echo ws.sendkeys "{D}"
  148. echo wscript.sleep 500
  149. echo ws.sendkeys "^+{Tab}"
  150. echo wscript.sleep 500
  151. echo ws.sendkeys "^+{Tab}"
  152. echo wscript.sleep 500
  153. echo ws.sendkeys "^+{Tab}"
  154. echo wscript.sleep 500
  155. echo ws.sendkeys "{D}"
  156. echo wscript.sleep 500
  157. echo ws.sendkeys "{ENTER}"
  158. echo ws.run "cmd /c ncpa.cpl",0
  159. echo wscript.sleep 1000
  160. echo ws.sendkeys "{f5}"
  161. echo wscript.sleep 1000
  162. echo 创建快捷方式:"%linkName%">con
  163. echo ws.sendkeys "%linkName%"
  164. echo wscript.sleep 500
  165. echo ws.sendkeys "%%{f}"
  166. echo wscript.sleep 500
  167. echo ws.sendkeys "{s}"
  168. echo wscript.sleep 300
  169. echo ws.sendkeys "{y}"
  170. echo wscript.sleep 300
  171. echo ws.sendkeys "%%{f4}")>%temp%\vpn.vbs
  172. start /wait %temp%\vpn.vbs
  173. ::del /f /q "%temp%\vpn.vbs" >nul
  174. echo.
  175. goto:start
  176. :end ==============================================================
  177. echo 按任意键退出&pause>nul
  178. exit/b
复制代码
“阿姐走了。。。可是。。。我。。。我愿意。”

TOP

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

TOP

返回列表