# Reg_ExistKey

> Checks if specified key exists.

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

### Description

Checks if specified key exists

### Syntax

Reg_ExistKey(sHandle, sKey, bMustExist) as Boolean

### Parameters

#### sHandle (String)

HKEY-Handle

#### sKey (String)

Subkey path

#### bMustExist (Boolean)

TRUE if the key must exist

### Return value

Result will be stored in gbValue

### Example

**VBScript**

```vb
If bStatus Then bStatus = Reg_ExistKey("HKLM", "Software\KeyName", 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/)
