Jump to content

Specific key search in registry


Recommended Posts

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.

Link to comment
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 *

Link to comment
Share on other sites

  • 4 years later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...