88

I need to open URL in Microsoft Edge (on Windows 10). When I invoke

start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://www.google.com

then Microsoft Edge is started correctly but it doesn't open the given URL (www.google.com, in this case). It opens Bing search where the given URL is used as a search term instead.

Jan Štola
  • 1,118
  • 1
  • 7
  • 6
  • 2
    I just tested your command above in PowerShell and it correctly opened google.com for me. – Ryan Joy Jul 01 '15 at 18:31
  • Thanks for pointing this out. My command really works in PowerShell. I tried it in Command Prompt (cmd) before (where it opens Bing search as I mentioned). I am really confused why the behaviour is different in cmd and PowerShell but I am fine with running the command through PowerShell. – Jan Štola Jul 07 '15 at 09:02
  • 1
    If it's not working for some reason check your quotes. I had an issue with `explorer "microsoft-edge:https://www.example.com/foo?querystring=yes"` when not using quotes (though using `start` I didn't have any issue, either way). – Tyler Szabo Oct 12 '18 at 21:46

12 Answers12

119

The following method should work via Command Prompt (cmd):

start microsoft-edge:http://www.cnn.com
Sampson
  • 265,109
  • 74
  • 539
  • 565
Charles Morris - MSFT
  • 2,111
  • 1
  • 15
  • 13
  • 11
    How did you even figure that out? seriously! I would not have ever tried that.. (works on Windows 10 Edge) – kodybrown Aug 06 '15 at 04:53
  • How would you launch it from c#? Thanks. – Andrea Nagar Aug 09 '15 at 21:55
  • 3
    @wasatchwizard: see [How to script Microsoft's Edge browser](http://www.itworld.com/article/2943955/windows/how-to-script-microsofts-edge-browser.html) – Remy Lebeau Oct 29 '15 at 21:28
  • This is great, but does anyone have any idea how this technique was worked out? It would be great to have it confirmed by MS somewhere, to know it is reasonably future-proof, but I can't find anything ... – FruitBreak Feb 01 '16 at 15:07
  • The problem I run into is that you have to specify the protocol (http:// or https://) or it won't work. This is not ideal for me. I would like to be able to open a site using www.mysite.com – BeanFlicker May 14 '16 at 00:07
  • `start` here is just a particular command. It is similar to "Run" dialog. – progalgo Aug 11 '16 at 09:53
  • any ideas how to get the http response from edge for the given request? – Wojciech Kulma Sep 09 '16 at 21:44
  • 4
    @FruitBreak, a little late here, but this works because capable url associations (launchable protocols) for Microsoft-Edge include the following: `http`, `https`, `microsoft-edge`, and `read`. The particular protocol in question, `Microsoft-Edge`, is specific to Edge, while others are subject to default app settings ("choose default apps by protocol"). If edge is your default app for the `read` protocol, then you can launch it by typing the following in file explorer `read:http://www.cnn.com`. `http` and `https` can be set as seperate protocols or together by the default web browser. – u8it Sep 27 '17 at 17:00
  • There may also be other protocols supports by different versions of Edge, like `microsoft-edge-holographic` – u8it Sep 27 '17 at 17:04
  • This only works for relatively short URLs. Any URL longer than 245 characters is truncated. Here's a sample command line you can try: C:\Windows\System32\cmd.exe /c explorer "microsoft-edge:https://www.garbage.com/?signature=012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" – Scott Gartner Nov 27 '18 at 22:19
  • It turns out that using CMD there are URL length limitations, but using PowerShell there aren't (or at least the long URLs I tried worked). However, PowerShell may not run from the command line on a stock Windows without changing security settings. Example: PowerShell "start microsoft-edge:http://stackoverflow.com" – Scott Gartner Nov 27 '18 at 22:38
  • 1
    The `file:` scheme is not supported! – Polluks Feb 26 '19 at 11:25
  • for `file:\\\ ` protocol [see the answer below](https://stackoverflow.com/a/46731977/1951524). – Martin Schneider Jul 03 '19 at 13:07
  • It won't work when working with url having get params `start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://localhost:8080/sample?a&b=1` – Archis Thakkar May 07 '20 at 16:17
  • How to open a specific profile of Edge using shell script ? – kudlatiger Feb 11 '22 at 04:09
  • Is there any way to mention a specific profile? – Abinash May 24 '22 at 07:55
  • If you have thew new Chromium-based edge, you can simply call the exe and pass an **absolute** path to the file. See [this answer](https://stackoverflow.com/a/62150382/1048186). Example from Git Bash with `$i` holding the full filename: `start msedge $(cygpath -wa $(pwd)/$i);` – Josiah Yoder Jan 02 '23 at 20:04
11

Windows 10: Create a shortcut with this destination:

%windir%\system32\cmd.exe /c "start microsoft-edge:https://twitter.com"
StackzOfZtuff
  • 2,534
  • 1
  • 28
  • 25
simmondp
  • 119
  • 1
  • 2
  • 1
    Note that you don't need to use the quotes there. So if you need to use a program-parameters string syntax then you can use `"c:/windows/system32/cmd.exe"` as a program and `"/c start microsoft-edge:%u"` as a parameter string. – Nux Oct 30 '15 at 18:46
9

and a shortcut:

C:\Windows\System32\cmd.exe /c start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://localhost:6516
RBT
  • 24,161
  • 21
  • 159
  • 240
  • 2
    this is the only way that also supports the `file:///` protocol for opening local files. – Martin Schneider Jul 03 '19 at 12:43
  • It doesn't work if url is `http://localhost:6516/sample?x=1&y=2` it results `http://localhost:6516/sample?x` which is wrong – Archis Thakkar May 07 '20 at 15:18
  • @ArchisThakkar The ampersand sign (&) cannot be used in middle of the command in the command line. Try this instead `C:\Windows\System32\cmd.exe /c start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge "http://localhost:6516/sample?x=1&y=2"` – Fabricio Nov 12 '20 at 09:38
  • The above didn't work as double-quotes were not escaping. This worked for me `C:\Windows\System32\cmd.exe /c start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://localhost:6516/sample?x=1^&y=2` – Archis Thakkar Nov 19 '20 at 08:40
8

All the other solutions work for Microsoft Edge (legacy) and on Windows 10 only. As of 2020, it will be discontinued and replaced by Microsoft Edge (Chromium based).

The solution that works with the new Edge on Windows 7, 8 and 10 is :

start msedge URL

Source :

Baptistou
  • 1,749
  • 1
  • 13
  • 24
7

I too was wondering why you can't just start microsoftedge.exe, like you do "old-style" applications in windows 10. Searching the web, I found the answer -- it has to do with how Microsoft implemented "Universal Apps".

Below is a brief summary taken from that answer, but I recommend reading the entire entry, because it gives a great explanation of how these "Universal Apps" are being dealt with. Microsoft Edge is not the only app like this we'll be dealing with.

Here's the link: http://www.itworld.com/article/2943955/windows/how-to-script-microsofts-edge-browser.html

Here's the summary from that page:

"Microsoft Edge is a "Modern" Universal app. This means it can't be opened from the command line in the traditional Windows manner:  Executable name followed by command switches/parameter values. But where there's a will, there's a way. In this case, the "way" is known as protocol activation."

Kudos to the author of the article, Stephen Glasskeys.

Dave
  • 8,163
  • 11
  • 67
  • 103
phreich
  • 79
  • 1
  • 4
5

While the accepted answer is correct, it has the unwanted artifact of flashing a console window when running from a non-console application.

The solution I found works best, which is only mentioned here in a comments to the question, is the following command line:

explorer.exe "microsoft-edge:<URL>"

Keep in mind that if contains the % sign you will need to type %% as Windows uses the symbol for variable expansion.

Hope someone finds this helpful.

Lockszmith
  • 2,173
  • 1
  • 29
  • 43
4

Personally, I use this function which I created and put in my profile script ...\Documents\WindowsPowerShell\….profile, feel free to use it. As I am from the UK, I prefer to go to .co.uk where possible, if you are from another area, you can add your own country code.

# Function taking parameter add (address) and opens in edge.
Function edge {
    param($add)
    if (-not ($add -contains "https://www." -or $add -contains "http://www.")) {
        if ($add[0] -eq "w" -and $add[1] -eq "w" -and $add[2] -eq "w") {
            $add = "https://" + $add
        } else {
            $add = "https://www." + $add
        }
    }

    # If no domain, tries to add .co.uk, if fails uses .com
    if (-not ($add -match ".co" -or $add -match ".uk" -or $add -match ".com")) {
        try {
            $test = $add + ".co.uk"
            $HTTP_Request  = [System.Net.WebRequest]::Create($test)
            $HTTP_Response = $HTTP_Request.GetResponse()
            $add = $add + ".co.uk"
        } catch{
            $add = $add + ".com"
        }
    }
    Write-Host "Taking you to $add"
    start microsoft-edge:$add
}

Then you just have to call: edge google in powershell to go to https://www.google.co.uk

4

Looks like things have changed and the previous solution doesn't work anymore.

However, here is the working command to launch CNN.com on Microsoft Edge:

microsoft-edge:http://www.cnn.com
WarPro
  • 350
  • 3
  • 5
3

I would like to recommend:
Microsoft Edge Run Wrapper
https://github.com/mihula/RunEdge

You run it this way:

RunEdge.exe [URL]
  • where URL may or may not contains protocol (http://), when not provided, wrapper adds http://
  • if URL not provided at all, it just opens edge

Examples:

RunEdge.exe http://google.com
RunEdge.exe www.stackoverflow.com

It is not exactly new way how to do it, but it is wrapped as exe file, which could be useful in some situations. For me it is way how to start Edge from IBM Notes Basic client.

Spockie
  • 39
  • 2
3

I want to complement other answers here in regards to opening a blank tab in Microsoft Edge from command-line.

I want to add an observation from my end. Windows doesn't detect the command microsoft-edge if I remove the trailing colon. I thought colon would be required only when I've to provide the target URL to open e.g. when I've to open a blank tab. But that's not the case. Color (:) is required all the time.

How to open a blank tab in Microsoft Edge?

  • From Run prompt (press Window logo + R):

    microsoft-edge:about:blank
    microsoft-edge:
    msedge
    
  • From Command(cmd.exe) prompt:

    start microsoft-edge:about:blank
    start microsoft-edge:
    start msedge
    

You can also initiate a search using Edge from run prompt. Let's say I've to search Barack Obama then fire below command on run prompt-

microsoft-edge:Barack Obama

It starts Microsoft's Bing search website in Edge with Barack Obama as search term.

RBT
  • 24,161
  • 21
  • 159
  • 240
  • How do I open the New Tab page instead of a blank page? `start microsoft-edge:about:newtab` does not seem to work as it opens Edge with the default search engine and `about:newtab` as a search term only. – Gerd Sep 23 '20 at 14:24
0

It will do more or less the same thing in good old dos script fashion

set add=%1
if %add%$ ==$ set add="about:blank" && goto launch

rem http://
set test=%add:~0, 7%
if %test% == http:// goto launch

rem ftp:// 
set test=%add:~0, 6%
if %test% == ftp:// goto launch

rem https://
set test=%add:~0, 8%
if %test% == https:// goto launch

rem add http
set add=http://%add%

:launch
start microsoft-edge:%add%
Simon PA
  • 748
  • 13
  • 26
0

microsoft-edge:http://google.com (open google as desired)
microsoft-edge: (just open)

Jan Kyu Peblik
  • 1,435
  • 14
  • 20