78

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.

rjdkolb
  • 10,377
  • 11
  • 69
  • 89
Nathan
  • 1,445
  • 2
  • 11
  • 29
  • 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. – Dan Henderson May 09 '17 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 09 '17 at 22:41
  • Visit this link for more informations : – Bk01 Nov 18 '20 at 00:48

9 Answers9

175

You can just use

explorer "https://google.com"

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

And on Mac I've using

open "https://google.com"
Jay Wick
  • 12,325
  • 10
  • 54
  • 78
41

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.

kjv
  • 1,057
  • 9
  • 6
  • 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 '18 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 '18 at 16:29
  • 1
    Unlike `explorer ` this works for `http://username:password@localhost:8080/`. – Vlastimil Ovčáčík Apr 15 '18 at 14:29
  • 2
    Much nicer solution. – CodeMonkey Jun 08 '18 at 07:23
34

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

prime
  • 14,464
  • 14
  • 99
  • 131
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.

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).

Franci Penov
  • 74,861
  • 18
  • 132
  • 169
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 :)

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
VaLo
  • 29
  • 1
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)

VitaminYes
  • 151
  • 3
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).

Vadorequest
  • 16,593
  • 24
  • 118
  • 215