The answer to this question shows how to launch Edge with a web URL from C#:
System.Diagnostics.Process.Start("microsoft-edge:http://www.google.com");
However, this doesn't seem to work with file URLs.
System.Diagnostics.Process.Start("microsoft-edge:file:///C:/foo/bar.html");
launches Edge, but the file is not displayed. Instead, Edge opens to its default page. Pasting the same URL ("file:///C:/foo/bar.html") into the Edge address bar works fine, and if I right-click the file in Explorer and choose Open With->Edge, the same URL appears in the address bar.
Does anyone know how to launch Edge with a file URL?
TIA
Microsoft Edge Start Page URL : r/MicrosoftEdge.
Locate your html file in file explorer and right click on it > open with > select microsoft edge. Your html will be now open on microsoft edge. You can also set default apps for html files, go to your system settings and search for default apps and select microsoft edge and then in next page for .
As noted in the comments, Edge does not support the file: protocol via the command line at this time.
However, it is currently possible to launch Edge with a local file using IApplicationActivationManager
. The necessary code can be extracted from the C# version of MicrosoftEdgeLauncher and integrated into a C# application.
See 'MicrosoftEdgeLauncherCsharp' at https://github.com/MicrosoftEdge/edge-launcher. To launch with a local file, use 'file:///d:/path/filename.ext' as the arguments
parameter to ActivateApplication
.
One dirty solution: first set your default launcher as Edge.
Suppose the file you want to open is file:///C:/foo/bar.html
, you can launch it using explorer
:
explorer file:///C:/foo/bar.html
Which will open Edge with the HTML for you.
This seems to be the only solution after start microsoft-edge:file:///C:/foo/bar.html
no longer works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With