62,271
社区成员
发帖
与我相关
我的任务
分享
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.ClassesRoot;
Microsoft.Win32.RegistryKey key1 = key.OpenSubKey(@"http\shell\open\command",false);
string fullPath = key1.GetValue("").ToString();
int endIndex = fullPath.ToLower().IndexOf(".exe");
string FileName = fullPath.Substring(1, endIndex).Replace(@"\","/") + "exe";
System.Diagnostics.FileVersionInfo FileVer = System.Diagnostics.FileVersionInfo.GetVersionInfo(FileName);
Response.Write("<br />"+FileVer.FileName+"=========="+key1.GetValue("").ToString()+";=============<br />");
Response.Write("FileVer.Comments--" + FileVer.Comments + "<br />");
Response.Write("FileVer.CompanyName--" + FileVer.CompanyName + "<br />");
Response.Write("FileVer.FileDescription--" + FileVer.FileDescription + "<br />");
Response.Write("FileVer.FileMajorPart--" + FileVer.FileMajorPart + "<br />");
Response.Write("FileVer.FileMinorPart--" + FileVer.FileMinorPart + "<br />");
Response.Write("FileVer.FileName--" + FileVer.FileName + "<br />");
Response.Write("FileVer.FilePrivatePart--" + FileVer.FilePrivatePart + "<br />");
Response.Write("FileVer.FileVersion--" + FileVer.FileVersion + "<br />");
Response.Write("FileVer.InternalName--" + FileVer.InternalName + "<br />");
Response.Write("FileVer.OriginalFilename--" + FileVer.OriginalFilename + "<br />");
Response.Write("FileVer.PrivateBuild--" + FileVer.PrivateBuild + "<br />");
Response.Write("FileVer.ProductBuildPart--" + FileVer.ProductBuildPart + "<br />");
Response.Write("FileVer.ProductMajorPart--" + FileVer.ProductMajorPart + "<br />");
Response.Write("FileVer.ProductMinorPart--" + FileVer.ProductMinorPart + "<br />");
Response.Write("FileVer.ProductName--" + FileVer.ProductName + "<br />");
Response.Write("FileVer.ProductPrivatePart--" + FileVer.ProductPrivatePart + "<br />");
Response.Write("FileVer.ProductVersion--" + FileVer.ProductVersion + "<br />");
Response.Write("FileVer.SpecialBuild--" + FileVer.SpecialBuild + "<br />");
private void Form1_Load(object sender, EventArgs e)
{
Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.ClassesRoot;
Microsoft.Win32.RegistryKey key1 = key.OpenSubKey(@"http\shell\open\command", true);
MessageBox.Show(key1.GetValue("").ToString());
} 通过注册表找到火狐的路径
private void Form1_Load(object sender, EventArgs e)
{
System.Diagnostics.FileVersionInfo FileVer = System.Diagnostics.FileVersionInfo.GetVersionInfo(@"D:\Program Files\Mozilla Firefox\firefox.exe");
MessageBox.Show(FileVer.FileVersion);
}