20

The executable MicrosoftEdge.exe cannot be launched directly like other EXEs in windows. I confirmed that from my own experience, and by reading this and that.

I also cannot launch it via Process.Start("MicrosoftEdge.exe") in my c# winforms app.

There must be some way to launch Edge from winforms without resorting to 3rd-party app and other clutter. I have already tried the following, with no success:

  1. Process.Start("MicrosoftEdge.exe") - unhandled exception
  2. Process.Start("microsoft-edge") - unhandled exception
  3. Process.Start("%windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge") - unhandled exception
  4. Process.Start(@"c:\Windows\SystemApps\Microsoft.MicrosoftEdge_8wekyb3d8bbwe\MicrosoftEdge.exe") - no exception, but nothing happens

Note: I can easily launch Chrome and Firefox using method #1 above.

How can I launch MS Edge from my .net winforms app?

Community
  • 1
  • 1
HerrimanCoder
  • 6,835
  • 24
  • 78
  • 158
  • 1
    Check [this link](https://aruntalkstech.wordpress.com/2015/08/12/launch-a-universal-app-from-a-wpf-app/); it has a WPF sample but the codebehind should work too for winforms – Josh Part Sep 21 '16 at 21:11
  • 1
    @SweatCoder Have you tried the suggestions here [How to open URL in Microsoft Edge from the command line?](http://stackoverflow.com/questions/31164253/how-to-open-url-in-microsoft-edge-from-the-command-line) – sly Sep 21 '16 at 21:11
  • Try number 3 with both a fielname and a Arguments parameter. – rheitzman Sep 21 '16 at 21:13
  • 2
    `Process.Start("msedge.exe")` Works for me. – Automate This Dec 06 '20 at 01:25

4 Answers4

32

The ":" at the end is inportant, otherwise won't work

To open in blank:

System.Diagnostics.Process.Start("microsoft-edge:");

or specifying an address:

System.Diagnostics.Process.Start("microsoft-edge:http://www.google.com");
TaW
  • 53,122
  • 8
  • 69
  • 111
user1845593
  • 1,736
  • 3
  • 20
  • 37
4

Process.Start can take 2 parameters

string url = "http://www.google.com";
System.Diagnostics.Process.Start("msedge.exe", url);

Browsers:

  • msedge.exe
  • chrome.exe
  • firefox.exe
  • iexplore.exe
Ken
  • 739
  • 5
  • 16
2

You can use a small workaround to open Microsoft Edge from CMD with this code

string url = "https://www.google.com";

// Starts Microsoft Edge with the provided URL; NOTE: /C to terminate CMD after the command runs
System.Diagnostics.Process.Start("CMD.exe", $"/C start msedge {url}");
1

The other answers are both valid, but there's one small issue I ran into when trying to use the option listed by @user1845593. It didn't work unless I used the ProcessStartInfo class and set UseShellExecute to true.

I was executing this with .net 6 and the below sample works for me. If I attempt to pass the same thing straight to Process.Start it fails.

var processInfo = new ProcessStartInfo("microsoft-edge:");
processInfo.UseShellExecute = true;
Process.Start(processInfo);
CrossBound
  • 56
  • 5