Jan*_*nie 6 vbscript powershell batch-file
我想编写一个自动加载网址(例如http://google.com)的脚本.但我不想在服务器上安装任何第三方库或程序.最简单的方法是什么?
我只是我的选项是批处理脚本,vb脚本或powershell对吗?
Kei*_*ill 19
来自PowerShell的FYI,如果要检索URL的内容,可以执行此操作;
$page = (new-object net.webclient).DownloadString("http://www.bing.com")
$page # writes the contents to the console
Run Code Online (Sandbox Code Playgroud)
如果您只想在浏览器中打开它:
Start-Process http://www.bing.com
Run Code Online (Sandbox Code Playgroud)
或者使用起始别名
start http://www.bing.com
Run Code Online (Sandbox Code Playgroud)
Start-Process是PowerShell 2.0中的新增功能.
你可以使用vb脚本
url="http://somewhere.com"
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
objHTTP.Open "GET", url, False
objHTTP.Send
wscript.Echo objHTTP.ResponseText
objFile.Close
Run Code Online (Sandbox Code Playgroud)