49

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

Kazark
  • 3,419
  • 3
  • 26
  • 35
  • 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 May 22 '11 at 17:38

8 Answers8

84

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
  • 997
  • 9
  • 11
  • 50
    Remember to use `start "" "some://url?with=special&chars=:->"` otherwise things will break. – Joey Sep 06 '09 at 07:22
  • 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. – рüффп Jun 02 '15 at 07:00
  • 3
    I need to remove the quotes, otherwise it opens a new CMD. – David Gras May 26 '17 at 08:53
  • 2
    @daVe you need an empty quote pair like Joey said if the url is quoted – phuclv Jun 04 '18 at 15:00
  • 1
    @Joey When the comment is more useful than the answer... – jpmc26 Nov 09 '18 at 21:28
  • @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 Feb 12 '20 at 02:23
  • 2
    When the FIRST parameter has quotes, it is taken as the title of the CMD window. That's why `start "" thingie` run thingie, but `start "thingie"` runs CMD. – Jesse Chisholm Sep 02 '21 at 03:12
9

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
  • 283
  • 2
  • 7
  • 1
    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 Aug 07 '14 at 18:22
6

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

Ƭᴇcʜιᴇ007
  • 111,883
  • 19
  • 201
  • 268
tim
  • 159
  • 2
  • 3
  • @ekaj Your right :/ First time i tried it it didn't work - for some reason it now worked ... comment deleted – DavidPostill Nov 24 '14 at 20:04
  • Windows Server 2016: First time it displays a prompt asking you to choose a default browser, with a checkbox asking "Always use this app". – mozey Nov 18 '20 at 11:22
5

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
  • 1,466
  • 13
  • 10
3

You can use this in Powershell:

Start-Process "URL"
Wasif
  • 7,984
  • 2
  • 19
  • 32
1

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

"%PROGRAMFILES%\Internet Explorer\IExplore" "http://www.msn.com"
David Andres
  • 184
  • 2
0

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

C:\>start 'http://www.google.com'
Lova Chittumuri
  • 101
  • 1
  • 1
  • 2
-5

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
  • 21,642
  • 49
  • 139
  • 184
  • Is this `C#`? This does not work for me on Windows 7 using `cmd.exe`. – iglvzx Jun 06 '12 at 19:06
  • 2
    Tried this in PowerShell and it didn't work. Must be C#. Does this really answer the question? – Kazark Aug 07 '14 at 17:56
  • 2
    This 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 Jan 05 '17 at 12:10