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

[网络连接] 批处理自动宽带连接快捷方式并连接

@echo off

for /f "skip=3 tokens=2 delims=: " %%i in (D:\本机宽带密码和网卡IP.txt) do (
set id=%%i
goto Next
)
:Next
for /f "skip=4 tokens=2 delims=: " %%j in (D:\本机宽带密码和网卡IP.txt) do (
set pw= %%j
goto Exit
)
:Exit
pause>>nul

rem 生成rasphone.pbk文件
(echo [PPPoE]
echo Encoding=1
echo Type=5
echo AutoLogon=0
echo UseRasCredentials=0
echo DialParamsUID=17073671
echo Guid=FEB7DE67D8A49E4C89AFEE9315C22C7D
echo BaseProtocol=1
echo VpnStrategy=0
echo ExcludedProtocols=3
echo LcpExtensions=1
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
echo RedialOnLinkFailure=1
echo CallbackMode=0
echo CustomDialDll=
echo CustomDialFunc=
echo CustomRasDialDll=
echo AuthenticateServer=0
echo ShareMsFilePrint=0
echo BindMsNetClient=0
echo SharedPhoneNumbers=0
echo GlobalDeviceSettings=0
echo PrerequisiteEntry=
echo PrerequisitePbk=
echo PreferredPort=
echo PreferredDevice=
echo PreferredBps=0
echo PreferredHwFlow=0
echo PreferredProtocol=0
echo PreferredCompression=0
echo PreferredSpeaker=0
echo PreferredMdmProtocol=0
echo PreviewUserPw=1
echo PreviewDomain=0
echo PreviewPhoneNumber=0
echo ShowDialingProgress=1
echo ShowMonitorIconInTaskBar=1
echo CustomAuthKey=-1
echo AuthRestrictions=632
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
echo IpNBTFlags=0
echo TcpWindowSize=0
echo UseFlags=1
echo IpSecFlags=0
echo IpDnsSuffix=
echo.
echo NETCOMPONENTS=
echo ms_server=0
echo ms_msclient=0
echo.
echo MEDIA=rastapi
echo Port=PPPoE6-0
echo Device=WAN 微型端口 (PPPOE^)
echo.
echo DEVICE=PPPoE
echo PhoneNumber=
echo AreaCode=
echo CountryCode=1
echo CountryID=1
echo UseDialingRules=0
echo Comment=
echo LastSelectedPhone=0
echo PromoteAlternates=0
echo TryNextAlternateOnFail=1)>rasphone.pbk


copy /y rasphone.pbk "%allusersprofile%\Application Data\Microsoft\Network\Connections\Pbk" >nul

(echo set ws=createobject("wscript.shell"^)
echo ws.run "rasphone -a"
echo wscript.sleep 500
echo ws.sendkeys "%%{r}"
echo wscript.sleep 300
echo ws.sendkeys "%%{n}"
echo wscript.sleep 300
echo ws.sendkeys "{enter}"
echo wscript.sleep 300
echo ws.run "cmd /c ncpa.cpl",0
echo wscript.sleep 1000
echo ws.sendkeys "{down}"
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}"
echo ws.run "rasphone -d 宽带连接"
echo wscript.sleep 1000
echo ws.sendkeys "%id%"
echo wscript.sleep 300
echo ws.sendkeys "{tab}"
echo ws.sendkeys "%pw%"
echo wscript.sleep 300
echo ws.sendkeys "%%{s}"
echo wscript.sleep 300
echo ws.sendkeys "%%{c}")>网络连接.vbs
start /wait 网络连接.vbs
del /f /q rasphone.pbk 网络连接.vbs
看看则个能行吗请吧备份文件放在D盘的根目录下(D:\本机宽带密码和网卡IP.txt在网上找获取上网帐号密码并自动保存到D盘的软件
http://www.gpxz.com/softinfo/1648.html

行不行你亲自试试不就知道了?
我帮忙写的代码不需要付钱。如果一定要给,请在微信群或QQ群发给大家吧。
【微信公众号、微信群、QQ群】http://bbs.bathome.net/thread-3473-1-1.html
【支持批处理之家,加入VIP会员!】http://bbs.bathome.net/thread-67716-1-1.html

TOP

rasphone.pbk 文件生成好了后, 宽带连接的快捷方式没必要从网络连接文件夹中发送按键来生成,

发送按键总是不那么可靠的, 不如直接生成一个指向 rasdial.exe 文件的快捷方式, 并带有参数,

Arguments 属性来指定参数, 在参数中包含进 帐号 和 密码就行了, 以后, 网络连接中的宽带连接即使帐号,密码信息发
生错误, 也不会影响这个快捷方式, 这个快捷方式只要 rasphone.pbk 中存在一个宽带连接就行了

TOP

返回列表