views:

24

answers:

2

I want to write a script that loads a url (eg. http://google.com) automatically. But I don't want to install any 3rd party libraries or programs to the server. what's the easiest way to do this?

I just my options are batch script, vb script or powershell right?

A: 

you can use vbscript

url="http://somewhere.com"
Set objHTTP = CreateObject( "WinHttp.WinHttpRequest.5.1" )
objHTTP.Open "GET", url, False
objHTTP.Send
wscript.Echo objHTTP.ResponseText
objFile.Close
ghostdog74
+3  A: 

FYI from PowerShell, if you want to retrieve the contents of the URL you can do this;

$page = (new-object net.webclient).DownloadString("http://www.bing.com")
$page # writes the contents to the console

If you just want to open it in a browser:

Start-Process http://www.bing.com

Or using the start alias

start http://www.bing.com

Start-Process is new in PowerShell 2.0.

Keith Hill