# Reg_ExistVariable

> Checks if specified variable exists.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/registry-functions/reg-existvariable/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Checks if specified variable exists

### Syntax

Reg_ExistVariable(sHandle, sKey, sVariable, bMustExist) as Boolean

### Parameters

#### sHandle (String)

HKEY-Handle

#### sKey (String)

Subkey path

*sVariable*

Variable to test existence of

#### bMustExist (Boolean)

TRUE if the key must exist

### Return value

Result will be stored in gbValue

### Example

**VBScript**

```vb
If bStatus Then bStatus = Reg_ExistVariable("HKLM", "Software\KeyName", "ValueName", False)
If bStatus Then bStatus = Job_Writelog("Custom", "gbValue: " & gbValue, bStatus, True)
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[Registry Functions](/capainstaller/vb-scripting-library/registry-functions/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
