82

I have a program launching a website via the following command.

cmd "start /max http://url.com"

When launching a website via this method it uses the default browser with its default settings for opening a new window. for example, Firefox and IE will open the window inside the tab of an existing window if they are set to do so. I have reports of IE 6 replacing the content of a current opened window with the content of url.com. I've tested this and sure enough when IE 6 is set as the default browser and with a current webpage opened the above will replace the content of the opened window with url.com rather than opening a fresh window.

Upon running some tests I see the command listed here:

cmd "start /max iexplore.exe http://url.com"

will consistently open a new window( with Internet Explorer of course) regardless of an existing window being present or not.

Can anyone tell me if I'm missing a silly setting in IE 6 or if there is a way to duplicate the "always open a new window" functionality exhibited by calling iexplore.exe directly, but with calling the user default browser instead.

3
  • 4
    +1 because your initial example was what I needed. I didn't have the problem that prompted your question, so none of these answers helped - all I needed was to know that "start http://url.com" uses the default browser with its default settings for opening a new window. May 9, 2017 at 22:03
  • 1
    Glad it helped. It's an old question about an issue that was ultimately ie6 related. So I hope no one runs into the actual problem anymore =)
    – Nathan
    May 9, 2017 at 22:41
  • Visit this link for more informations : <stackoverflow.com/a/64885208/14658432>
    – Bk01
    Nov 18, 2020 at 0:48

9 Answers 9

179

Windows

explorer "https://google.com"

Which will launch your default browser and navigate to that site.

As @RiverHeart pointed out if your URL has special characters like ? you can escape the URL like so in Windows 10+

explorer "`"https://www.google.com/search?q=hello+there"`"

MacOS

open "https://google.com"
5
  • Is there a way to tell the default browser to be in incognito mode? Jun 2, 2022 at 19:33
  • 2
    The explorer solution just opens explorer for me (Windows 11)
    – Jeppe
    Jun 24, 2022 at 11:23
  • The explorer solution just opens explorer for me (Windows 10)
    – Kintaro
    Mar 7 at 10:36
  • I don't have any Windows machines to test this, but I wonder if Win 11 and 10 using PowerShell by default might affect this 🤔
    – Jay Wick
    Mar 23 at 3:50
  • Explorer uses certain chars as wildcards so if you give it a ? for a query string URL it'll fail. You need to wrap the whole URL in double quotes like "`"url`"" in powershell and if you find that helpful give this man an upvote
    – RiverHeart
    Oct 2 at 18:05
43

To open a URL with the default browser, you can execute:

rundll32 url.dll,FileProtocolHandler https://www.google.com

I had issues with URL parameters with the other solutions. However, this one seemed to work correctly.

5
  • I can see how there would be issues with query params using start explorer http://www.google.com as that is using windows explorer adn passing it a url.. which works. is there also issues just using start by itselft? start http://google.com?q=test on a mac currently cant test.
    – Nathan
    Mar 13, 2018 at 15:47
  • 1
    Neither of those worked. rundll32 is the only thing that worked for me. But, I was executing this from Go not from a cmd prompt.
    – kjv
    Mar 14, 2018 at 16:29
  • 1
    Unlike explorer <url> this works for http://username:password@localhost:8080/. Apr 15, 2018 at 14:29
  • 2
    Much nicer solution.
    – CodeMonkey
    Jun 8, 2018 at 7:23
  • This is exactly what I was looking for, works better than any solution I've found with the start command or explorer. Thanks :)
    – Justin G
    Oct 6 at 7:36
34

start chrome https://www.google.com/ or start firefox https://www.google.com/

2
  • 3
    Ideal when you want to invoke a non-default browser. You don't need to specify a path because start will find chrome or firefox.
    – BSalita
    Jun 27, 2016 at 13:08
  • 1
    For Internet Explorer use: start iexplore URL Nov 16, 2018 at 0:18
11

This worked for me:

explorer <YOUR URL>

For example:

explorer "https://www.google.com/"

This will open https://www.google.com/ in your default browser.

1
  • It just opens explorer for me (Windows 10)
    – Kintaro
    Mar 7 at 10:37
6

IE has a setting, located in Tools / Internet options / Advanced / Browsing, called Reuse windows for launching shortcuts, which is checked by default. For IE versions that support tabbed browsing, this option is relevant only when tab browsing is turned off (in fact, IE9 Beta explicitly mentions this). However, since IE6 does not have tabbed browsing, this option does affect opening URLs through the shell (as in your example).

0
2

You can start web pages using command line in any browser typing this command

cd %your chrome directory%
start /max http://google.com

save it as bat and run it :)

0
2

Working from VaLo's answer:

cd %directory to browser%
%browser's name to main executable (firefox, chrome, opera, etc.)% https://www.google.com

start https://www.google.com doesn't seem to work (at least in my environment)

1

Ok, The Windows 10 BatchFile is done works just like I had hoped. First press the windows key and R. Type mmc and Enter. In File Add SnapIn>Got to a specific Website and add it to the list. Press OK in the tab, and on the left side console root menu double click your site. Once it opens Add it to favourites. That should place it in C:\Users\user\AppData\Roaming\Microsoft\StartMenu\Programs\Windows Administrative Tools. I made a shortcut of this to a folder on the desktop. Right click the Shortcut and view the properties. In the Shortcut tab of the Properties click advanced and check the Run as Administrator. The Start in Location is also on the Shortcuts Tab you can add that to your batch file if you need. The Batch I made is as follows

@echo off
title Manage SiteEnviro
color 0a
:Clock
cls
echo Date:%date% Time:%time%
pause
cls
c:\WINDOWS\System32\netstat
c:\WINDOWS\System32\netstat -an
goto Greeting

:Greeting
cls
echo Open ShellSite
pause
cls
goto Manage SiteEnviro

:Manage SiteEnviro
"C:\Users\user\AppData\Roaming\Microsoft\Start Menu\Programs\Administrative Tools\YourCustomSavedMMC.msc"

You need to make a shortcut when you save this as a bat file and in the properties>shortcuts>advanced enable administrator access, can also set a keybind there and change the icon if you like. I probably did not need :Clock. The netstat commands can change to setting a hosted network or anything you want including nothing. Can Canscade websites in 1 mmc console and have more than 1 favourite added into the batch file.

0

Using a CLI, the easiest way (cross-platform) I've found is to use the NPM package https://github.com/sindresorhus/open-cli

npm install --global open-cli

Installing it globally allows running something like open-cli https://unlyed.github.io/next-right-now/.

You can also install it locally (e.g: in a project) and run npx open-cli https://unlyed.github.io/next-right-now/

Or, using a NPM script (which is how I actually use it): "doc:online": "open-cli https://unlyed.github.io/next-right-now/",

Running yarn doc:online will open the webpage, and this works on any platform (windows, mac, linux).

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