Accessing Registry Keys with Spaces

DaLeeMan

New member
Joined
Sep 4, 2010
Messages
1
Programming Experience
10+
I'm trying to access a registry key that has a space in it, specifically:

Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update

The key is valid and I believe the code is, though I can't get any keys with spaces to open using Registry.OpenSubKey


The following code fails only for keys with spaces:

subkey = New String("Software\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update")

m_hive = m_hive.OpenSubKey(subkey, False)
Dim val As Object = m_hive.GetValue(key)


I appreciate any help...This small issue is really messing with my Saturday plans!!
 
There is no problem with spaces in registry keys with the .Net registry classes, so your must be a different one. This for example opens the "Auto Update" key for reading when I execute it:
VB.NET:
Dim key = My.Computer.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update")
 
Back
Top