In .Net, when using the GetValue method of the Microsoft class to read registry data, the data are actually "processed";
For example, the original value of a string data is %SystemRoot%\System32\ but the data obtained using the GetValue method is C:\WINDOWS\System32\
That is to say, when reading strings in the registry, the system will unfold environment variables for you on its own initiative.
This does save us the trouble of calling methods, but in turn, we are helpless when we want to copy a registry string intact.
In .Net2.0, we were surprised to find that there was a small change in the Microsoft. class, which was that its GetValue method added a new overload:
public Object GetValue (
string name,
Object defaultValue,
RegistryValueOptions options
)
The third parameter of this method is an enum, and currently only one useful value is DoNotExpandEnvironmentNames.
Specify this value, and the result of GetValue is that there is no expanded data.