micor Posted July 8, 2004 Posted July 8, 2004 When getting values containing environment variables from the registry, you may get the %var% text. Sure, I can replace the % and do a EnvGet to get the "real" value of it. But what if the returned value is say: %SystemRoot%\Temp It there a more simple way to get it to say: C:\Windows\Temp than using StringMid and replacing % + EnvGet. And finally, yes I am aware of the macros @WindowsDir, @SystemDir and @TempDir. They are all very nice, but do not provide the solution to my problem... -----some examples------- The first example will result in %SystemRoot%. $test = regread("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","windir") msgbox(0,"Test",$test) The second example will result in %SystemRoot%\TEMP on most machines. $test = regread("HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment","Temp") msgbox(0,"Test",$test) I gotta be the biggest nutcase ever for trying something this stupid...
Administrators Jon Posted July 8, 2004 Administrators Posted July 8, 2004 Only literal strings get expanded so that wouldn't work.
SlimShady Posted July 8, 2004 Posted July 8, 2004 (edited) Only literal strings get expanded so that wouldn't work.I didn't know that. (I had problems before, but they're solved now.)Can you make it that you can read env. variables using string variables? Edited July 8, 2004 by SlimShady
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now