# Reg_GetExpandString

> Gets the value of a registry variable of type expandable string.

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

### Description

Gets the value of a registry variable of type expandable string

### Syntax

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

### Parameters

#### sHandle (String)

HKEY-handle

#### sKey (String)

Subkey path

#### sVariable (String)

Name of variable to read

#### bMustExist (Boolean)

TRUE if variable must exist

### Return value

Result will be stored in gsValue.

Note: The value returned is not being interpreted or converted in any way. Meaning that if the function returns the value "%USERPROFILE%\My Documents", it is not being converted into e.g. C:\Documents and Settings\Administrator\My Documents.

### Example

**VBScript**

```vb
If bStatus Then bStatus = Reg_GetExpandString("HKLM", "Software\KeyName", "ValueName", False)
If bStatus Then bStatus = Job_WriteLog("Custom", "gsValue: " & gsValue, 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/)
