Can I launch URLs from command line in Windows?

36

4

Can I launch URLs directly from the command line in Windows?

Krishna Kumar

Posted 2009-09-06T05:02:35.080

Reputation:

I always thought iexplore www.google.com would work i'm sure i've done it in the past loads of times, but it didn't. So, stick c:\program files\internet explorer, in the path and it will. Personally I make another environment variable for long boring stuff like MOREPATH="c:\program files\internet explorer". Then path=.......;%MOREPATH% That's in control panel..system..environment variables. now iexplore www.google.com will damn well work! – barlop – 2011-05-22T17:38:51.463

Answers

63

Yes, with the start command. Example:

start http://www.google.com

That will use the user's default browser.
As stated by Joey, you should use a different format for URLs with special chars:

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

Botz3000

Posted 2009-09-06T05:02:35.080

Reputation: 787

Nice, another nice feature for this solution is that you can also do start www.google.com but I admit it will not always work. – рüффп – 2015-06-02T07:00:33.920

3I need to remove the quotes, otherwise it opens a new CMD. – daVe – 2017-05-26T08:53:45.937

2@daVe you need an empty quote pair like Joey said if the url is quoted – phuclv – 2018-06-04T15:00:50.890

1@Joey When the comment is more useful than the answer... – jpmc26 – 2018-11-09T21:28:32.153

@Joey I submitted an edit to this answer to save the next guy a few clicks. Pretty lame that surrounding a parameter in quotes changes the program's behavior. – vinnyjames – 2020-02-12T02:23:17.850

45Remember to use start "" "some://url?with=special&chars=:->" otherwise things will break. – Joey – 2009-09-06T07:22:16.527

7

you can use

start http://www.google.com

Interestingly only following combination are working for above url :

start www.google.com
start http://google.com
start http://blog.google.com

But following is not working :

start google.com
start asp.net
start blog.google.com

I think it is because in the later example google.com and asp.net are treated as files and it tries to find google.com file and gives error on not finding it.

I think it is hardcoded for www. Any better guesses ?

MRG

Posted 2009-09-06T05:02:35.080

Reputation: 263

It's probably because start works for several applications (not only websites). providing at least www or http:// the start command links your URI to the HTTP protocol, while it could probably run other protocols. – Jeff Noel – 2014-08-07T18:22:01.983

4

What's "launch" in this context? You can start http://www.foo.bar/ or the like, your default browser will come up and visit that URL -- is that what you mean?

Alex Martelli

Posted 2009-09-06T05:02:35.080

Reputation: 1 298

4

You could use explorer <url> which will use your default browser.

tim

Posted 2009-09-06T05:02:35.080

Reputation: 131

@ekaj Your right :/ First time i tried it it didn't work - for some reason it now worked ... comment deleted – DavidPostill – 2014-11-24T20:04:02.890

1

Here's a cheap approach that will work on XP at least:

"%PROGRAMFILES%\Internet Explorer\IExplore" "http://www.msn.com"

David Andres

Posted 2009-09-06T05:02:35.080

Reputation: 184

Cheap in what sense? – Kazark – 2014-08-07T18:19:24.010

1@Kazark: cheap in that it opens up the URL in Internet Explorer as opposed to whatever the default browser happens to be. – David Andres – 2014-08-11T11:44:35.983

13Ouch... and msn.com no less. – None – 2009-09-06T05:09:11.103

first thing that came to mind...for no apparent reason whatsoever – David Andres – 2009-09-06T06:38:35.493

0

you can run this below command and it will redirect to google chrome browser

C:\>start 'http://www.google.com'

Lova Chittumuri

Posted 2009-09-06T05:02:35.080

Reputation: 101

-6

From C# code you could just run this (cmd-start equivalent):

Process.Start("http://stackoverflow.com");

You've launched your url from a command-line directly (i.e. without running another program first).

Ian Boyd

Posted 2009-09-06T05:02:35.080

Reputation: 18 244

1Tried this in PowerShell and it didn't work. Must be C#. Does this really answer the question? – Kazark – 2014-08-07T17:56:19.063

1This is not CMD syntax, nor does it seem to be valid Powershell. I could remove my downvote if the poster updated his answer with details. – oligofren – 2017-01-05T12:10:02.457

Is this C#? This does not work for me on Windows 7 using cmd.exe. – iglvzx – 2012-06-06T19:06:31.690