Reputation:
I am looking for the solution to determine the default browser of my Win10 without entering registry.
For now I know it only using registry.
For example, is there an option to access Settings -> Apps -> Default apps? Or any wmic
command to know it?
Thank you in advance!
Upvotes: 2
Views: 257
Reputation:
On .NET Core it works in this way:
myProcess.StartInfo.UseShellExecute = true;
myProcess.StartInfo.FileName = "http://www.stackoverflow.com";
myProcess.Start();
Console.WriteLine("Your default browser is " + myProcess.ProcessName);
Upvotes: 0
Reputation: 52240
Process.Start
accepts the name of a document and will open the default application for that document. You can then inspect the name of the process.
var process = Process.Start("http://www.stackoverflow.com");
Console.WriteLine("Your default browser is " + process.ProcessName);
Upvotes: 4