Sign in to follow this  
Followers 0
vegaslaptop

Specific key search in registry

4 posts in this topic

Hello everyone,

I am trying to read the reg value for a certain key.

$var = RegRead("HKEY_USERS\S-1-5-21-2041921852-553933441-806110124-10729\Environment", "Something")
$var1 = RegRead("HKEY_USERS\S-1-5-21-2041921852-553933441-806110124-10729\Environment", "Something1")
MsgBox(4096, "Program files are in:", $var)
MsgBox(4096, "Program files are in:", $var1)

Now I read the values fine and my program works fine on my local machine. BUT the path changes with every machine. e.g.

HKEY_USERS\S-1-5-21-2041921852-553933441-806110124-10729\Environment

changes to something like

HKEY_USERS\S-1-5-21-2041921852-553933441-806110124-104070\Environment

Everything remains the same except the middle part of the path in registry. Is there an easy way to search for this key path and thus assign a variable? Or is there a way to set a wildcard for the middle part of the registry path?

All inputs are very appreciated.

Share this post


Link to post
Share on other sites



Now I read the values fine and my program works fine on my local machine. BUT the path changes with every machine. e.g.

It's not changing with the machine, but with the user you are logged in. BTW: On a different machine, the SID of the same username will be different. That's the reason why it does not work on another computer.

Obviously you want to read the environment variables of a user. So, better use EnvGet() and EnvSet() instead of reading the registry.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thank you I will try it.

YES IT WORKS! THANK YOU!

Edited by besnia

Share this post


Link to post
Share on other sites

i know this is an old thread but i am in the same boat but dont know which variable to search for. i tried envget("SID") and envget("USER"). nothing in the windows list of variables seems to work.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0