![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-05 00:08 |
共 48,038 主题排行 / 350,123 发帖 / 今日 0 篇 / 48,251 会员排行 |
| DOS批处理 & 脚本技术(批处理室) » 如何用批处理或VBS建立一个PPPOE连接 |
| 可打印版本 927 / 2 |
| 第1楼 huanglsh | 发表于 2007-06-14 21:27 |
| 新手上路 发帖 6 积分 15 | |
|
如何用批处理或VBS建立一个PPPOE连接 想用批处理或VBS在XP下建立一PPPOE的连接
望高手们帮帮忙 找了个VBS的 Set objShell = CreateObject("Wscript.Shell") strCommandLine = "Rasphone -a" objShell.Run(strCommandLine) set WshShell = CreateObject("WScript.Shell") WScript.Sleep 200 WshShell.SendKeys "r" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") set oShellLink = WshShell.CreateShortcut(strDesktop & "\宽带连接.lnk") oShellLink.TargetPath = "%windir%\system32\Rasphone.exe" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+K" oShellLink.IconLocation = "%windir%\system32\Rasphone.exe, 0" oShellLink.Description = "宽带连接" oShellLink.WorkingDirectory = "%windir%\system32\" oShellLink.Save 以上代码不行.不能直接建立 [ Last edited by bjsh on 2007-7-31 at 02:53 PM ] |
|
| 第2楼 slore | 发表于 2007-06-14 21:51 |
| 铂金会员 发帖 2,478 积分 5,212 | |
|
Set WshShell = CreateObject("WScript.Shell")
strCommandLine = "Rasphone -a" WshShell.Run(strCommandLine) WScript.Sleep 5000 '把这里要设置的时间长点 WshShell.SendKeys "r" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" strDesktop = WshShell.SpecialFolders("Desktop") Set oShellLink = WshShell.CreateShortcut(strDesktop & "\宽带连接.lnk") oShellLink.TargetPath = "%windir%\system32\Rasphone.exe" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+K" oShellLink.IconLocation = "%windir%\system32\Rasphone.exe, 0" oShellLink.Description = "宽带连接" oShellLink.WorkingDirectory = "%windir%\system32\" oShellLink.Save Set oShellLink = Nothing Set WshShell = Nothing |
|
| 第3楼 huanglsh | 发表于 2007-06-14 23:32 |
| 新手上路 发帖 6 积分 15 | |
|
谢谢你的回答.这样可以创建军了!!!
改了一下.只是建立个连接.不用在桌面有图标. 然后用rasdial拔号上去 Set WshShell = CreateObject("WScript.Shell") strCommandLine = "Rasphone -a" WshShell.Run(strCommandLine) WScript.Sleep 500 '把这里要设置的时间长点 WshShell.SendKeys "r" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" WScript.Sleep 30 WshShell.SendKeys "pppoe" WScript.Sleep 30 WshShell.SendKeys "{ENTER}" Set oShellLink = Nothing Set WshShell = Nothing Dim wshShell Set wshShell = CreateObject("Wscript.Shell") Set EnvVar = wshShell.Environment("PROCESS") Name=EnvVar.Item("COMPUTERNAME") strGateway = Array("1.1.1.1") strComputer="." Set objWMIService=GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colNetAdapters=objWMIService.ExecQuery("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE") strGatewayMetric = Array(1) For Each objNetAdapter in colNetAdapters errGateways = objNetAdapter.SetGateways(strGateway, strGatewaymetric) '设置网关 Next Set WshNetwork = Nothing dim wsh set wsh=WScript.CreateObject("WScript.Shell") wsh.run "Rasdial pppoe 用户名 密码",false,1 WScript.quit [ Last edited by huanglsh on 2007-6-14 at 11:57 PM ] |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |