Hey there gang.
I'm wanting to return the actual values of the registry keys in the User
Shell Folders key.
An example of a value stored in one of these keys would be:
"%USERPROFILE%\Application Data"
and I would like to actually return the following when querying it:
"%USERPROFILE%\Application Data"
However, when returning these values using the code below (VB.Net), it
resolves the %USERPROFILE% variable, and returns its correspnding value, eg:
"C:\documents and settings......\Application Data"
Reading through the docs it says the string can be returned in three
available 'categories':
*********************************************
String values can be represented as the following categories:
* sz: Data is represented as a null-terminated Unicode string value.
* multi_sz: Data is represented as an array of null-terminated Unicode
strings.
* expanded_sz: Data is represented as a null-terminated Unicode string with
expanded references to environment variables.
*********************************************
But I see no way of specifying the sz format..
Code is as follows:
************************************************
Dim USF As RegistryKey =
Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
PrintKeyValues(USF)
Private Sub PrintKeyValues(ByVal rkey As RegistryKey)
' Retrieve all the value names for the specified key.
Dim names As String() = rkey.GetValueNames()
Dim icount As Integer = 0
Console.WriteLine("Values of " & rkey.Name)
Console.WriteLine("-----------------------------------------------")
' Print the contents of the array to the console.
Dim s As String
For Each s In names
Dim sv As String = rkey.GetValue(s).ToString
Console.WriteLine(s & ": " & sv)
Next s
Console.ReadLine()
End Sub
***********************************************
Any ideas?
TIA,
Andrew
I'm wanting to return the actual values of the registry keys in the User
Shell Folders key.
An example of a value stored in one of these keys would be:
"%USERPROFILE%\Application Data"
and I would like to actually return the following when querying it:
"%USERPROFILE%\Application Data"
However, when returning these values using the code below (VB.Net), it
resolves the %USERPROFILE% variable, and returns its correspnding value, eg:
"C:\documents and settings......\Application Data"
Reading through the docs it says the string can be returned in three
available 'categories':
*********************************************
String values can be represented as the following categories:
* sz: Data is represented as a null-terminated Unicode string value.
* multi_sz: Data is represented as an array of null-terminated Unicode
strings.
* expanded_sz: Data is represented as a null-terminated Unicode string with
expanded references to environment variables.
*********************************************
But I see no way of specifying the sz format..
Code is as follows:
************************************************
Dim USF As RegistryKey =
Registry.CurrentUser.OpenSubKey("Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders")
PrintKeyValues(USF)
Private Sub PrintKeyValues(ByVal rkey As RegistryKey)
' Retrieve all the value names for the specified key.
Dim names As String() = rkey.GetValueNames()
Dim icount As Integer = 0
Console.WriteLine("Values of " & rkey.Name)
Console.WriteLine("-----------------------------------------------")
' Print the contents of the array to the console.
Dim s As String
For Each s In names
Dim sv As String = rkey.GetValue(s).ToString
Console.WriteLine(s & ": " & sv)
Next s
Console.ReadLine()
End Sub
***********************************************
Any ideas?
TIA,
Andrew