首页 > 系统相关 >windows 获取系统中所有应用程序

windows 获取系统中所有应用程序

时间:2023-07-30 22:34:12浏览次数:48  
标签:string windows 应用程序 GetValue sk 获取 ToString Comments var

前言:

  记录下。

重点

  

  RegistryView.Registry64 与 RegistryView.Registry32 。有些程序在 Registry64 中,有些程序在 Registry32 中。

 代码

查看代码

            var localMachine = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
            string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall";
            using (RegistryKey rk = localMachine.OpenSubKey(uninstallKey))
            {
                foreach (string skName in rk.GetSubKeyNames())
                {
                    using (RegistryKey sk = rk.OpenSubKey(skName))
                    {
                        try
                        {

                            var displayName = sk.GetValue("DisplayName") ?? "";
                            if (string.IsNullOrWhiteSpace(displayName.ToString()))
                            {
                                continue;
                            }
                            var size = sk.GetValue("EstimatedSize") ?? "";
                            var displayVersion = sk.GetValue("DisplayVersion") ?? "";
                            var installDate = sk.GetValue("InstallDate") ?? "";
                            var publisher = sk.GetValue("Publisher") ?? "";
                            var installLocation = sk.GetValue("InstallLocation") ?? "";
                            var version = sk.GetValue("Version") ?? "";
                            var versionMinor = sk.GetValue("VersionMinor") ?? "";
                            var versionMajor = sk.GetValue("VersionMajor") ?? "";
                            var uninstallString = sk.GetValue("UninstallString") ?? "";
                            var helpLink = sk.GetValue("HelpLink") ?? "";
                            var DisplayIcon = sk.GetValue("DisplayIcon") ?? "";

                            var HelpTelephone = sk.GetValue("HelpTelephone") ?? "";
                            var InstallSource = sk.GetValue("InstallSource") ?? "";
                            var URLInfoAbout = sk.GetValue("URLInfoAbout") ?? "";
                            var URLUpdateInfo = sk.GetValue("URLUpdateInfo") ?? "";
                            var AuthorizedCDFPrefix = sk.GetValue("AuthorizedCDFPrefix") ?? "";
                            var Contact = sk.GetValue("Contact") ?? "";
                            var Comments = sk.GetValue("Comments") ?? "";
                            var Language = sk.GetValue("Language") ?? "";
                            var ModifyPath = sk.GetValue("ModifyPath") ?? "";
                            var Readme = sk.GetValue("Readme") ?? "";
                            var SettingsIdentifier = sk.GetValue("SettingsIdentifier") ?? "";

                            ListViewItem item = new ListViewItem(new string[]
                            {
                                displayName.ToString(),
                                size.ToString(),
                                displayVersion.ToString(),
                                installDate.ToString(),
                                publisher.ToString(),
                                installLocation.ToString(),
                                versionMajor.ToString(),
                                version.ToString(),
                                versionMinor.ToString(),
                                uninstallString.ToString(),
                                helpLink.ToString(),
                                DisplayIcon.ToString(),

                                HelpTelephone.ToString(),
                                InstallSource.ToString(),
                                URLInfoAbout.ToString(),
                                URLUpdateInfo.ToString(),
                                AuthorizedCDFPrefix.ToString(),
                                Contact.ToString(),
                                Comments.ToString(),
                                Language.ToString(),
                                ModifyPath.ToString(),
                                Readme.ToString(),
                                SettingsIdentifier.ToString(),
                            });

                            lstDisplayHardware.Items.Add(item);
                        }
                        catch (Exception ex)
                        {

                        }
                    }
                }
            }

  我的源代码仓库,如果对您有帮助的话,star一下吧

标签:string,windows,应用程序,GetValue,sk,获取,ToString,Comments,var
From: https://www.cnblogs.com/youlicc/p/17592208.html

相关文章

  • web APIs获取dom元素
    1.获取页面中的标签最常用的两种方式 document.querySelectorAll和document.querySelector 2他们两个区别是什么document.querySelectorAll可以选择多个元素,得到伪数组,要遍历才能得到每一个元素document.querySelector只能得到一个元素,可以直接操作注意:它们里面的小括......
  • 【Spring Boot 初识丨八 丨外部应用程序属性 】
    上一篇讲了SpringBoot的外部化配置的加载顺序及一些简单的属性说明本篇来讲一讲外部化配置一些比较重要的部分SpringBoot初识:(外部化配置详解)外部应用程序属性  当您的应用程序启动时,SpringBoot将自动从以下位置查找并加载application.properties和application.......
  • Windows五次Shift漏洞
    Windows五次Shift漏洞标签(空格分隔):网络攻防技术实验原理当我们使用计算机时,连续按下5次shift键会弹出一个程序。该程序名称为“sethc.exe”,其路径为“c:\windows\system32\sethc.exe”。原理该系统漏洞由于部分Win7及Win10在未进入系统时,可以通过连续按5次shift键弹出seth......
  • Windows漏洞CVE-2019-0708
    Windows漏洞CVE-2019-0708标签(空格分隔):网络攻防技术1.python-exp攻击步骤(1)开启Windows7的远程桌面服务:在windows7系统中依次选择【控制面板】→【系统和安全】→【允许远程访问】打开远程访问服务。(2)下载漏洞利用脚本:在互联网上搜索CVE-2019-0708相关的漏洞利用脚本,可......
  • python数据分析师入门-学习笔记(第十节 数据获取)
    工具使用Anaconda官网下载安装一路next(默认就行)Chrome默认安装就行打开jupyternotebook打开anacondaprompt输入jupyternotebook系统自动打开一个网页快手掌握开发工具模式:代码模式markdown模式快捷键h查看所有快捷键esc编辑状态切换......
  • Windows系统安装使用Scoop包管理器
      前言Scoop是Windows的命令行安装程序。如果用过Linux系统,使用apt-get工具安装过软件,或者用过Python,知道pip工具用于管理Python各种依赖包,那么理解Scoop就比较容易,这些工具的设计理念与使用方法都非常类似。Scoop一般用来管理绿色软件,即是一种通过解压压缩包即可就地使......
  • Revit二次开发-获取族类型以及族参数值
      在族环境中获取当前族的所有族类型以及族类型对应的所有参数和参数值。直接上代码~publicoverrideResultExecute(ExternalCommandDatacommandData,refstringmessage,ElementSetelements){vardoc=commandData.Application.ActiveUIDocument......
  • 找回windows应用商店
    应用windows自带的应用商店,安装软件时,发现应用商店没了,则可以通过下面的方法找回1、在windows10 搜索  WindowsPowershell2、以管理员权限打开3、直接把下面这个语句粘贴进去Get-AppXPackage*WindowsStore*-AllUsers|Foreach{Add-AppxPackage-DisableDevelopme......
  • Windows下让git shell中的git命令走代理
    最近用clash跑stable-diffusion,发现git不走代理,间而出现各种问题,故记录一下。假如只针对GitHub:gitconfig--globalhttp.https://github.com.proxyhttp://127.0.0.1:XXXXgitconfig--globalhttps.https://github.com.proxyhttps://127.0.0.1:XXXX假如使用sock5gitconfig......
  • Soft Rasterizer (SoftRas) windows10 vscode 运行 环境配置记录
    配了好几天,一边搜索一边配,记录下做了些什么。我的环境:windows10,vscode,RTX3090配置cl环境变量安装openssl,配置环境变量安装libtorch,配置环境变量打开对应的虚拟环境里面的打开torch\include\ATen\Parallel.h,将inlineTORCHAPIvoidlazyinitnumthreads()的实现......