C# 打开默认浏览器

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Process p = new Process();
            p.StartInfo.FileName = GetIERunString();
            string c = "http://127.0.0.1/admin";
            p.StartInfo.Arguments = c;
            p.Start();

           
        }

        public static string GetIERunString()
        {
            string IEString = string.Empty;
            RegistryKey regKey = Registry.ClassesRoot;
            regKey = regKey.OpenSubKey(@"http\shell\open\command");
            IEString = regKey.GetValue("").ToString();
            string a = IEString;
            string[] b;
            b = a.Split(new char[1] { '"' });
            IEString = b[1];
            return IEString;
        }

    }
}
View Code

转载于:https://www.cnblogs.com/nocoding/p/3405714.html

猜你喜欢

转载自blog.csdn.net/weixin_34138139/article/details/94183412