Escape Characters in GUID

I can’t for the life of me figure out how to escape the GUID with a parameter.

parameter “PreviousGUID” = “{{0B0D7AD3-AF14-4760-B524-E43B7879EC25}”

This works but i had to add the escape char to the end of the GUID.
if {exists keys “{0B0D7AD3-AF14-4760-B524-E43B7879EC25}}” of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x64 registries; x32 registries)}
endif

This does not work. Can’t figure out how to add the escape char
if {exists keys parameter PreviousGUID of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x64 registries; x32 registries)}
endif

I have tried several variations that would include adding an extra }" but it still gives me the same error “expression contained character that is not allowed”

Any ideas how to accomplish this?

You only need to escape the } when you use it literally inside a relevance expression. When used in a parameter value, the escaping is not required (you have it correct where you’re creating the parameter)

I think the issue is in how you’re referencing the parameter. At the very least you need to quote the parameter name, i.e. parameter "PreviousGUID". It’s likely that using this with the keys <string> of registry property that you’ll also need to wrap it in parentheses. Try

if {exists keys (parameter "PreviousGUID") of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of (x64 registries; x32 registries)}
1 Like

You are 100% correct. That was a complete oversite. Thank you!

1 Like