How to open URL in Microsoft Edge from the command line?

前端 未结 12 697
天涯浪人
天涯浪人 2020-11-29 23:44

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

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


        
相关标签:
12条回答
  • 2020-11-30 00:05

    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%
    
    0 讨论(0)
  • 2020-11-30 00:10

    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.

    0 讨论(0)
  • 2020-11-30 00:11

    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.

    0 讨论(0)
  • 2020-11-30 00:12

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

    start microsoft-edge:http://www.cnn.com
    
    0 讨论(0)
  • 2020-11-30 00:12

    and a shortcut:

    C:\Windows\System32\cmd.exe /c start shell:AppsFolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge http://localhost:6516
    
    0 讨论(0)
  • 2020-11-30 00:12

    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.

    0 讨论(0)
提交回复
热议问题