Launching a website via windows commandline

WindowsCommand LineBrowserCmd

Windows Problem Overview


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.

Windows Solutions


Solution 1 - Windows

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"

Solution 2 - Windows

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.

Solution 3 - Windows

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

Solution 4 - Windows

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

Solution 5 - Windows

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.

Solution 6 - Windows

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

Solution 7 - Windows

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)

Solution 8 - Windows

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.

Solution 9 - Windows

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionNathanView Question on Stackoverflow
Solution 1 - WindowsJay WickView Answer on Stackoverflow
Solution 2 - WindowskjvView Answer on Stackoverflow
Solution 3 - WindowsprimeView Answer on Stackoverflow
Solution 4 - WindowsFranci PenovView Answer on Stackoverflow
Solution 5 - WindowsTahcin Ul Karim MycinView Answer on Stackoverflow
Solution 6 - WindowsVaLoView Answer on Stackoverflow
Solution 7 - WindowsVitaminYesView Answer on Stackoverflow
Solution 8 - WindowsRussell AbrahamView Answer on Stackoverflow
Solution 9 - WindowsVadorequestView Answer on Stackoverflow