• wmi 读取所有已安装软件


    void Main()
    {
        ManagementObjectSearcher searcher = 
                        new ManagementObjectSearcher("root\CIMV2", 
                        "SELECT * FROM Win32_Product"); 
    
                    foreach (ManagementObject queryObj in searcher.Get())
                    {
                        Console.WriteLine("-----------------------------------");
            Console.WriteLine("Win32_Product instance");
            Console.WriteLine("-----------------------------------");
            Console.WriteLine("Name: {0}", queryObj["Name"]);
            Console.WriteLine("Version: {0}", queryObj["Version"]);
        }
    }
    void Main()
    {
        ManagementClass mgmt = new ManagementClass("Win32_Product");
        ManagementObjectCollection objCol = mgmt.GetInstances();
        foreach (ManagementObject obj in objCol)
        {
            Console.WriteLine("Product Name: {0}, Version: {1}.",
                obj.Properties["Name"].Value.ToString(),
                obj.Properties["Version"].Value.ToString());
        }
    }
  • 相关阅读:
    如何判断栈的增长方向
    时间复杂度
    shell基础part3
    shell基础part2
    shell基础part2
    linux基础part5
    linux基础part4
    linux基础part3
    linux基础part2
    shell基础part1
  • 原文地址:https://www.cnblogs.com/nanfei/p/13157538.html
Copyright © 2020-2023  润新知