Ian Vink
Ian Vink

Reputation: 68750

Open a Web Page in a Windows Batch FIle

I have a batch file that does a bunch of things and at the end needs to open up a web browser to a page. Is there a way to, in essence, call ShellExecute on a http to open the web page?

Windows Command Prompt

Upvotes: 164

Views: 432922

Answers (6)

Tilak Patil
Tilak Patil

Reputation: 109

  1. To run from the default browser, use

    start http://www.stackoverflow.com
    

    Please make sure that the appropriate browser is set as the default in Control Panel → default program:

    Enter image description here

  2. To launch a page from a specific browser, one can use

    start "iexplore.exe" http://www.stackoverflow.com
    
    start "chrome.exe" http://www.stackoverflow.com
    
    start "firefox.exe" http://www.stackoverflow.com
    

Upvotes: 8

user4481177
user4481177

Reputation: 37

When you use the start command to a website, it will use the default browser by default, but if you want to use a specific browser, then use start iexplorer.exe www.website.com

Also, you cannot have http:// in the URL.

Upvotes: 2

Ross Ridge
Ross Ridge

Reputation: 39571

You can use the start command to do much the same thing as ShellExecute. For example

 start "" http://www.stackoverflow.com

This will launch whatever browser is the default browser, so it won't necessarily launch Internet Explorer.

Upvotes: 269

stackers
stackers

Reputation: 3270

start did not work for me.

I used:

firefox http://www.stackoverflow.com

or

chrome http://www.stackoverflow.com

Obviously not great for distributing it, but if you're using it for a specific machine, it should work fine.

Upvotes: 0

npocmaka
npocmaka

Reputation: 57252

hh.exe (help pages renderer) is capable of opening some simple webpages:

hh http://www.nissan.com

This will work even if browsing is blocked through:

HKEY_CURRENT_USER\Software\Policies\Microsoft\Internet Explorer

Upvotes: 2

Daryl Gill
Daryl Gill

Reputation: 5524

Unfortunately, the best method to approach this is to use Internet Explorer as it's a browser that is guaranteed to be on Windows based machines. This will also bring compatibility of other users which might have alternative browsers such as Firefox, Chrome, Opera..etc,

start "iexplore.exe" http://www.website.com

Upvotes: 3

Related Questions