/*
*修改默認浏覽器
*/
//浏覽器路徑
string exePath = @"F:\firefox\firefox.exe";
//注冊表項
string reg = @"http\shell\open\command";
string nameReg = @"http\shell\open\ddeexec\Application";
RegistryKey key = null;
try
{
key = Registry.ClassesRoot.OpenSubKey(reg, true);
if (key != null)
{
key.SetValue("", string.Format("\"{0}\" -- \"%1\"", exePath));
key.Close();
key = Registry.ClassesRoot.OpenSubKey(nameReg, true);
if (key != null)
{
key.SetValue("", Path.GetFileNameWithoutExtension(exePath));
key.Close();
}
}
}
catch (Exception)
{
key.Close();
}