PLu*_*Lui 1 browser url vbscript
我想让我的VB脚本转到后台的URL.它可以在后台打开浏览器并在之后关闭它.越"沉默"越好.我有2个实现可以在我的机器上工作,但不适用于另一个:
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("iexplore.exe " & myURL, 1)
Run Code Online (Sandbox Code Playgroud)
这是另一个:
Set objExplorer = WScript.CreateObject _
("InternetExplorer.Application", "IE_")
objExplorer.Navigate myURL
'Determines if the window is visible or not
objExplorer.Visible = 0
'Suspend the script for 1 minute
WScript.Sleep 6000
'Close the IE (instantiated) window
objExplorer.quit
Run Code Online (Sandbox Code Playgroud)
...其中myURL是包含URL的字符串变量.
我无法弄清楚为什么上面的任何一个在我的笔记本电脑上工作但在服务器上没有.任何帮助,将不胜感激.
如果您正在寻找一种静默方法,我建议完全删除Internet Explorer COM对象并寻找一个XMLHttpRequest对象:
myURL = "http://www.google.com/"
Set req = CreateObject("MSXML2.XMLHTTP.6.0")
req.Open "GET", myURL, False
req.Send
WScript.Echo req.ResponseText
Run Code Online (Sandbox Code Playgroud)