简体   繁体   English

如何在Windows 7 64位上使用C#从注册表中获取所有启动过程的列表?

[英]How to get list of all startup processes from Registry using C# on Windows 7 64 bit?

Hi guys I have a strange issue. 大家好,我有一个奇怪的问题。

I am trying to get list of all startup programs from Registry - LocalMachine,CurrentUser, subkeys Run, RunOnce, RunOnceEx. 我试图从注册表中获取所有启动程序的列表-LocalMachine,CurrentUser,Run,RunOnce,RunOnceEx子项。 And after that I can get list of links in Startup folder 之后,我可以在“启动”文件夹中获取链接列表

For Win64 I found that startup programs are in this key 对于Win64,我发现启动程序在此注册表项中

LocalMachine/Software/Wow6432Node/Microsoft/Windows/CurrentVersion/Run LocalMachine /软件/ Wow6432Node / Microsoft / Windows / CurrentVersion / Run

The problem is in this code, running it I get List of apps which are in different Subkey LocalMachine\\Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Run instead of the described bellow LocalMachine\\Software\\Microsoft\\Windows\\CurrentVersion\\Run 问题是在此代码中运行,我得到位于不同子项LocalMachine \\ Software \\ Wow6432Node \\ Microsoft \\ Windows \\ CurrentVersion \\ Run中的应用程序列表,而不是所描述的以下波纹管LocalMachine \\ Software \\ Microsoft \\ Windows \\ CurrentVersion \\ Run

Is that normal? 那是正常的吗?

 Microsoft.Win32.RegistryKey key;
 key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", false);

 foreach (string appName in key.GetValueNames()) 
 {
      try
      {
         MessageBox.Show(appName);
      }
      catch (Exception ex) 
      {

      }

 }

I tryed using this WMI solution but it didnt get all startup apps. 我尝试使用此WMI解决方案,但未获得所有启动应用程序。 That's why i decided to get them manually from the Registry. 这就是为什么我决定从注册表中手动获取它们的原因。

  1. Is this script correct and why it doesn't do what it is supposed to do? 该脚本正确吗?为什么它不执行应做的工作?
  2. Is there any other way to get all startup apps and processes? 还有其他方法来获取所有启动应用程序和进程吗?

    Thanks 谢谢

On a 64-bits windows OS, there are 2 distinct HKLM\\Software hives. 在64位Windows操作系统上,有2个不同的HKLM \\ Software配置单元。 One for 64-bits apps (which is HKLM\\Software) and one for 32-bits apps (which is HKLM\\Software\\Wow6432Node when viewed from a 64-bits apps. It is viewed as HKLM\\Software for a 32-bits apps). 从64位应用程序查看时,一个用于64位应用程序(即HKLM \\ Software),另一个用于32位应用程序(即HKLM \\ Software \\ Wow6432Node)。对于32位应用程序,它被视为HKLM \\ Software。 )。

If you compile your .Net application as MSIL or x64, you could access the 32-bit software hive by adding Wow6432node to the registry path. 如果将.Net应用程序编译为MSIL或x64,则可以通过将Wow6432node添加到注册表路径来访问32位配置单元。

Otherwise, you could also compile as x86 and run in 32-bits. 否则,您也可以编译为x86并以32位运行。

Hope this help 希望这个帮助

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用C#获取64位计算机中所有ODBC或访问数据源的列表 - How to Get list of all ODBC or Access DataSources in 64 Bit Machine using C# Windows中的64位和32位注册表问题(在C#中编程) - 64 bit & 32 bit Registry issue in Windows (Programming in c#) 如何使用WMI通过C#在64位计算机(WOW)上以32位模式运行的应用程序访问64位注册表配置单元信息 - How can I access 64 bit registry hive information from a application running in 32 bit mode on a 64 bit machine(WOW) using WMI through C# 在Windows中获取所有启动过程 - get all startup processes in windows C#无法从Windows Server 2012 64位上的Wow6432Node读取注册表值 - C# not reading registry values from Wow6432Node on Windows Server 2012 64-bit 如何使用c#代码从64位机器上的64位应用程序获取32位应用程序数据文件夹 - how to get 32 bit application data folder from 64 bit application on 64 bit Machine using c# code C#访问64位注册表 - C# Access 64 bit Registry 如何从找到32位应用程序的安装但在使用C#的64位OS上的注册表中读取REG_BINARY值 - How to read a REG_BINARY value from registry where installations of 32bit applications are found, but on a 64bit OS using C# 如何使用 C# 从 windows Temp 文件夹中删除所有文件? (当进程运行时) - How do you delete all files from the windows Temp folder using C#? (When the processes are running) 如何使用C#和Task Scheduler获取进程列表 - How to get list of processes using C# and Task Scheduler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM