出于某种原因,我有一个网络驱动器在我通过快捷方式访问它之前无法连接。所以我在启动脚本中添加了一个run命令来启动我的电子邮件和IM应用程序。该脚本有效,但我一直收到错误80004005。
Dim WshShell, objShell, oShell
Set objShell = WScript.CreateObject("WScript.Shell")
Set WshShell = CreateObject("WScript.Shell")
'Check for network connection
strURL = "server1"
set png = WshShell.exec("ping -n 1 " & strURL)
do until png.status = 1
WScript.Sleep 5000
loop
strPing = lcase(png.stdout.readall)
Select Case True
Case InStr(strPing, "reply from") > 1
'Launch Chrome
objShell.Run("""C:\Program Files (x86)\Google\Chrome\Application\chrome.exe""")
'Launch Pidgin
objShell.Run("""C:\Program Files (x86)\Pidgin\pidgin.exe""")
'Initiate Y:\
objShell.Run("C:\Users\kwag.myers\Documents\Y.lnk") 'this line errors
Wscript.Sleep 500
Set oShell = CreateObject("WScript.Shell")
oShell.AppActivate "Y:\"
Wscript.Sleep 500
WshShell.SendKeys "%{F4}"
Case Else
End Select
Set WshShell = Nothing
Set objShell = Nothing
WScript.Quit