I need to check if a registry value exists. How can i do this?
My first approach:
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" "NUL:" ${IF} $0 == "" MESSAGEBOX MB_OK "NUL exists" ${ELSE} WriteRegStr HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" "NUL:" "" ${ENDIF}
But it also works when the value does not exist. I think because "doesnt exist" and the empty string are treated the same way.
With Registry.nsh, I did this as follows:
${registry::Read} "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Ports" "NUL:" $var1 $var2 ${IF} $var2 == "REG_SZ"
But I get an error because Pop $ {_ STRING} in registry.nsh does not work.
Help and suggestions are welcome!
source share