[windows-10] How to open URL in Microsoft Edge from the command line?

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.

This question is related to windows-10 microsoft-edge

The answer is


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%

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.


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 :


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


and a shortcut:

C:\Windows\System32\cmd.exe /c start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://localhost:6516

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

One observation that I want to add from my end is that Windows doesn't detect the command microsoft-edge if I remove the trailing colon. I thought it would be the case when I've to open the browser without mentioning the target URL e.g. in case of opening a blank tab.

How to open a blank tab in Microsoft Edge?

  • From run prompt - microsoft-edge:about:blank
  • From command prompt - start microsoft-edge:about:blank

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.


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.


Windows 10: Create a shortcut with this destination:

%windir%\system32\cmd.exe /c "start microsoft-edge:https://twitter.com"

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.


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

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