C# 获取安装程序的路径

来源:互联网 发布:python微信自定义菜单 编辑:程序博客网 时间:2024/06/06 06:16

C# 获取安装程序的路径

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

 代码如下:

[csharp] view plaincopy
  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());

}


原创粉丝点击