'How to launch MS Edge from c# winforms?
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:
Process.Start("MicrosoftEdge.exe")- unhandled exceptionProcess.Start("microsoft-edge")- unhandled exceptionProcess.Start("%windir%\explorer.exe shell:Appsfolder\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge")- unhandled exceptionProcess.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?
Solution 1:[1]
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");
Solution 2:[2]
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
Solution 3:[3]
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}");
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | TaW |
| Solution 2 | Ken |
| Solution 3 | Florin Zamfir |
