MultiScript - Registry Functions
RegKeyExists | Check if a key exists. |
RegKeyAdd | Create new registry key. |
RegKeyDel | Delete registry key. |
RegKeyFind | Find registry key. |
RegKeyFindRegExp | Find registry key with a regular expression. |
RegValueExists | Check if a registry value exists. |
RegValueAdd | Create new registry value. |
RegValueDel | Delete a registry value. |
RegValueFind | Find registry value. |
RegValueFindRegExp | Find registry value using regual expression. |
RegValueGetSZ | Get string registry value. |
RegValueGetDWORD | Get DWORD registry value. |
Where regRoot is required as a parameter use any of the specified short paths
HKLM | HKEY_LOCAL_MACHINE |
HKCU | HKEY_CURRENT_USER |
HKCR | HKEY_CLASS_ROOT |
HKUR | HKEY_USER |
RegKeyExists
Check if a registry key exists.
<num> RegKeyExists(<str> regRoot, <str> regPath);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path of the key to check.
Return value
1 if the key exists, else 0.
Example
$exists = RegKeyExists("HKLM","Software\\Microsoft");
RegKeyAdd
Add a new registry key.
<num> RegKeyAdd(<str> regRoot, <str> regPath);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path of the key to add.
Return value
1 if key was added, 0 if failed to add key.
Example
RegKeyDel
Delete a registry key.
<num> RegKeyDel(<str> regRoot, <str> regPath);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path of the key to delete.
Return value
1 if key was deleted, 0 if failed to delete key.
Example
RegKeyFind
Get all matching subkeys in a specified registry path. Match keys using wildcards.
<arr> RegKeyFind(<str> regRoot, <str> regPath, <str> match);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path of where you want to find a key.
- match
- Wildcard for matching key, e.g. "Version_5.*"
Return value
An array with all matching key names.
Example
RegKeyFindRegExp
Get all matching subkeys in a specified registry path. Match key using regular expression.
<arr> RegKeyFindRegExp(<str> regRoot, <str> regPath, <str> regExp);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path where you want to find a key.
- regExp
- Regular expression used for matching keys.
Return value
An array with all matching key names.
Example
RegValueExists
Check if a registry value exists.
<num> RegValueExists(<str> regRoot, <str> regPath, <str> valuename);
Parameters
- regRoot
- Registry root, e.g."HKLM".
- regPath
- The registry path to the key that should have the value.
- valueName
- Name of the value to check for.
Return value
1 if value exists. 0 if it does not.
Example
$exists = RegValueExists("HLKM", "Software\\Microsoft", "installed");
RegValueAdd
Add a new registry value.
<num> RegValueAdd(<str> regRoot, <str> regPath, <str> valueName, <str> value, <str> type);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path to the key that the value should be created under.
- valueName
- Name of the registry value to create.
- value
- Value to set the registry value to.
- type
- Type of registry value to create. REG_SZ or REG_DWORD supported.
Return value
Name of the newly-added value.
RegValueDel
Delete registry value.
<num> RegValueDel(<str> regRoot, <str> regPath, <str> valuename);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- The registry path to the key that should have the value.
- valueName
- Name of the value to delete.
Return value
1 if value is deleted. 0 if deletion failed.
RegValueFind
Find all matching registry values under a registry key.
<arr> RegValueFind(<str> regRoot, <str> regPath, <str> valueMatch);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path to key under where you want to search for a value.
- valueMatch
- Wildcard for matching value. e.g. "Version_5.*"
Return value
An array of matching registry values.
RegValueFindRegExp
Find all matching registry value under a registry key, Using regular expression for matching
<arr> RegValueFindRegExp(<str> regRoot, <str> regPath, <str> valueRegExpMatch);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path to key under which you want to search for a value.
- valueRegExpMatch
- Regular expression for matching values.
Return value
An array of matching registry values.
RegValueGetSZ
Get the value of a REG_SZ registry value.
<str> RegValueGetSZ(<str> regRoot, <str> regPath, <str> valuename);
Parameters
- regRoot
- Registry root, e.g. "HKLM".
- regPath
- Registry path to key under which the value exists.
- valuename
- Name of the registry key value to return. (Must be a REG_SZ value).
Return value
The string value of the registry value. Returns an empty string if the value does not exist.
RegValueGetDWORD
Get the value of a REG_DWORD registry value .
<num> RegValueGetDWORD(<str> regRoot, <str> regPath, <str> valuename);
Parameters
- regRoot
- Registry root, e.g. "HKLM"
- regPath
- Registry path to key under where the value exists.
- valuename
- Name of the registry key value to return. (Must be a REG_DWORD value)
Return value
The value of the registry DWORD value. Returns 0 if value does not exist.