[英]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.
这就是为什么我决定从注册表中手动获取它们的原因。
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.