Archive: How do you check if a registry entry exists?


How do you check if a registry entry exists?
  I need to check if a registry entry exists! How do i do?


From the help:

ReadRegStr user_var(output)
root_key
sub_key
name

Reads from the registry into the user variable $x. Valid values for root_key are listed under WriteRegStr. The error flag will be set and $x will be set to an empty string ("") if the string is not present. If the value is present, but is of type REG_DWORD, it will be read and converted to a string and the error flag will be set.


ReadRegStr $0 HKLM SoftwareMicrosoft "Foobar"

>StrCmp $0 "" stringempty stringnotempty

stringempty:
>blahblahblah

stringnotempty:
>yddayaddayadda
>
got it?

The Help also says:

The error flag will be set and $x will be set to an empty string ("") if the string is not present.