Board logo

标题: 转:建立拨号连接并建立桌面快捷方式 baomaboy请进 [打印本页]

作者: eech     时间: 2007-6-9 23:06    标题: 转:建立拨号连接并建立桌面快捷方式 baomaboy请进

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

转的,在霏凡发个求助帖,引出这个脚本,请baomaboy兄过目,有无可改进的地方,能不能做的隐形运行,无任何窗口信息显示?可能吗?你是专家我听你的!

[ Last edited by eech on 2007-6-9 at 11:15 PM ]
作者: wudixin96     时间: 2007-6-9 23:23
偶的桌面从没宽带连接。呵呵
作者: baomaboy     时间: 2007-6-10 02:57


  Quote:
Originally posted by eech at 2007-6-9 23:06:
Set objShell = CreateObject("Wscript.Shell")
strCommandLine = "Rasphone -a"
objShell.Run(strCommandLine)
set WshShell = CreateObject("WScript.Shell")
WScript.Sleep ...

像是拼凑起来的,同一个对象建了三次。
Sleep的时间太短,会狂弹窗口。
oShellLink.TargetPath = Rasphone.exe 的话,拨号时会多一步选择所以:oShellLink.TargetPath = "rasphone.exe -d 宽带连接"
不熟悉Rasphone.exe是否支持参数静默创建连接,如果支持可以隐藏窗口。否则用sendkeys的方法就不能隐藏窗口。
作者: slore     时间: 2007-6-10 11:01
C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk

文件保留下来,然后创建快捷方式。。。

我这里的ID是{BA126AD7-2166-11D1-B1D0-00805FC1270E}
不知道你那里的一样不?而且这类的用VBS如何创建还是个问题……
作者: eech     时间: 2007-6-10 15:32


  Quote:
Originally posted by slore at 2007-6-10 11:01:
C:\Documents and Settings\All Users\Application Data\Microsoft\Network\Connections\Pbk

文件保留下来,然后创建快捷方式。。。

我这里的ID是{BA126AD7-2166-11D1-B1D0-00805FC ...

可以正常创建的,我试了
作者: zhoushijay     时间: 2007-6-11 10:21
我运行这个脚本怎么把realone给打开来了,汗
作者: baomaboy     时间: 2007-6-11 11:59
如果你得桌面没有realone就行了 ^_^
作者: slore     时间: 2007-6-11 13:39


  Quote:
Originally posted by eech at 2007-6-10 15:32:



可以正常创建的,我试了

???你可以创建CLSID的快捷方式?
作者: eech     时间: 2007-6-12 14:38


  Quote:
Originally posted by slore at 2007-6-11 13:39:


???你可以创建CLSID的快捷方式?

我意思是可以在桌面创建拨号!不是你说的那种