C# 获取安装程序的路径

C# 获取安装程序的路径

 如下图:AFAMShell 位 我的应用程序

 代码如下:

[csharp] view plain copy
  1. using System;  
  2. using System.Collections.Generic;  
  3. using System.Linq;  
  4. using System.Text;  
  5. using System.Diagnostics;  
  6. using System.Threading;  
  7. using Microsoft.Win32;  
  8.   
  9. namespace Project_Phoenix  
  10. {  
  11.     class Case  
  12.     {  
  13.         public static string  Get_AFAM_Path()  
  14.         {  
  15.             RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\AspenTech\AFAM\");  
  16.             string ss = key.GetValue("AFAMShell").ToString();  
  17.             return ss;  
  18.         }  
  19.     }  
  20. }  


写个 main 方法:

public static void  main()

{

       Console.WriteLine(Case.Get_AFAM_Path());

}


你可能感兴趣的:(C# 获取安装程序的路径)