Main Content

winqueryreg

Item from Windows registry

Description

example

valnames = winqueryreg('name',rootkey,subkey) returns all value names in rootkey\subkey of Microsoft® Windows® operating system registry. The first argument is the literal, quoted, case-sensitive string or character vector 'name'.

value = winqueryreg(rootkey,subkey,valname) returns the value for valname in rootkey\subkey.

value = winqueryreg(rootkey,subkey) returns a value in rootkey\subkey that has no value name property.

Examples

collapse all

Display Control Panel\Mouse values.

Get a list in variable mousechar for registry subkey Mouse, which is under subkey Control Panel, which is under root key HKEY_CURRENT_USER.

mousechar = winqueryreg('name','HKEY_CURRENT_USER','control panel\mouse');

For each name in the mousechar list, get its value from the registry and then display the name and its value:

for k = 1:length(mousechar)
   setting = winqueryreg('HKEY_CURRENT_USER','control panel\mouse',mousechar{k});
   str = sprintf('%s = %s',mousechar{k},num2str(setting));
   disp(str)
end
mousechar = 
    'ActiveWindowTracking'
    'Beep'
    'DoubleClickHeight'
    'DoubleClickSpeed'
    'DoubleClickWidth'
    'ExtendedSounds'
    'MouseHoverHeight'
    'MouseHoverTime'
    'MouseHoverWidth'
    'MouseSensitivity'
    'MouseSpeed'
    'MouseThreshold1'
    'MouseThreshold2'
    'MouseTrails'
    'SmoothMouseXCurve'
    'SmoothMouseYCurve'
    'SnapToDefaultButton'
    'SwapMouseButtons'

Input Arguments

collapse all

Root key name, specified as a case-sensitive string or character vector.

Example: 'HKEY_CLASSES_ROOT'

Subkey name, specified as a string or a character vector. The value is not case-sensitive.

Example: 'control panel\mouse'

Name of value, specified as a string or a character vector. The name is not case-sensitive.

Output Arguments

collapse all

Value names, specified as a cell array of character vectors.

Value of specified name, specified as a character vector if the value retrieved from the registry is a registry string value. If the value is a 32-bit integer, winqueryreg returns the value as an integer of the MATLAB® type int32.

Limitations

  • This function works for the following registry value types only:

    • strings (REG_SZ)

    • expanded strings (REG_EXPAND_SZ)

    • 32-bit integer (REG_DWORD)

See Also

Introduced before R2006a