Reputation: 459
I have a path in registry:
HKEY_LOCAL_MACHINE\Software\Windows NT\CurrentVersion\ProfileList
How can I get all folders at ProfileList folder?
I can use method GetSubKeyNames() to string array, but I haven't RegistryKey for ProfileList folder.
Upvotes: 0
Views: 246
Reputation: 43886
You're key is wrong. To read the profiles you have to use
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
So if you want to find the folder for each profile:
using(var key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"))
{
foreach(string name in key.GetSubKeyNames())
{
using (var subkey = key.OpenSubKey(name))
Console.WriteLine(subkey.GetValue("ProfileImagePath"))
}
}
Upvotes: 3