REG_EXPAND_SZ

G

Guest

Is there a way in VB.NET to work with this type of registry key? One of our
software providers uses this for a directory entry. There installer that
creates the entry when a user runs is is very buggy. I am working on a .NET
app that can create the necessarry registry keys and files needed for a user
to run a program. I am not sure how to read and write values using
REG_EXPAND_SZ. Thank in advance for any help with this one.
 
J

Jeffrey Tan[MSFT]

Hi nt32msngns,

Thanks for your post.

I am not sure I understand you very well. Can you explain your request in
more details? Normally, when we write an expandable environment variable
into the registry, it will not be expanded. For example, the code snippet
below will write the string "%path%" into the registry:
RegistryKey test9999 =
Registry.CurrentUser.CreateSubKey("Test9999");
test9999.SetValue("expandable string", "%PATH%");

If your request is how to write an expandable string into the registry or
is how to read %path% into the actual file system path, I think we can use
Environment.ExpandEnvironmentVariables to get this done. Something like
this:
RegistryKey test9999 =
Registry.CurrentUser.CreateSubKey("Test9999");
test9999.SetValue("expandable string",
Environment.ExpandEnvironmentVariables("%PATH%"));

Hope this helps.
If I misunderstand you, please feel free to tell me. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi nt32msngns,

Does my reply make sense to you? If you still have any concern, please feel
free to tell me, thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
J

Jeffrey Tan[MSFT]

It's my pleasure to help you

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top