159

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

1
  • 4
    When you say MS-DOS, I presume you mean Windows command prompt, not actual standalone MS-DOS?
    – NPE
    Commented Oct 6, 2014 at 20:03

6 Answers 6

264

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 won't necessarily launch Internet Explorer.

5
  • 1
    What if we want to open this webpage in a separate browser rather than the default one ?
    – Du-Lacoste
    Commented Oct 21, 2015 at 7:44
  • 9
    @DulithDeCozta If you want to open a webpage in a specific browser that installed on the machine you'll need to use something like: C:\path\to\browser.exe http://www.stackoverflow.com. You should ask your own question if you need more details.
    – Ross Ridge
    Commented Oct 21, 2015 at 17:34
  • 1
    What reason to use empty quotation marks? As I see start http://www.stackoverflow.com is enough to open page in default browser. Commented Jan 10, 2020 at 16:30
  • 5
    @Daniechka It's in case the URL needs double quotes. The command start "http://www.stackoverflow.com" won't work, but the command start "" "http://www.stackoverflow.com" will. See: stackoverflow.com/questions/27261692/… and stackoverflow.com/questions/44219435/…
    – Ross Ridge
    Commented Jan 10, 2020 at 18:27
  • start "chrome" localhost:8080 worked for me Commented Oct 1, 2021 at 16:26
7

1.To run from the default browser, use

start http://www.stackoverflow.com

Please make sure that the appropriate browser is set as default at Control Panel-> default program : enter image description here

2.To launch page from 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
1
  • The second part of your answer is wrong. The first argument to start in parentheses is not the name of the executable, but the title of the windows. See START /?, and verify with a non-existing executable such as start "moonlanding.exe" http://nasa.gov.
    – Lumi
    Commented Apr 20, 2023 at 7:25
3

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
1
  • 3
    still opens the default browser. The first quoted argument isn't the program to use, but the window title (ignored in case of a browser)
    – Stephan
    Commented Nov 12, 2020 at 11:25
2

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.

3
  • 4
    Are you sure it's not iexplore.exe Commented Aug 21, 2018 at 22:34
  • start "chrome" localhost:8080 worked for me. you answer is not 100% correct. thanks Commented Oct 1, 2021 at 16:25
  • Perhaps things have changed since your comment, but I now (Feb 2022) find http:// is accptable. A URL must start with either that or www. or both. Otherwise it gives a 'not found' error. Commented Feb 14, 2022 at 4:17
2

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
0

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.

2
  • chrome is not recognized as internal or external command. i got this error Commented Oct 1, 2021 at 16:23
  • it worked with start chrome "website" Commented Oct 1, 2021 at 16:24

Not the answer you're looking for? Browse other questions tagged or ask your own question.