Reference · reference
registry module (Windows)
use registry reads and writes the Windows registry. The module is registered on every platform, so a playbook compiles and validates identically everywhere; on Linux and macOS every call returns a runtime error. Guard a call with a step condition on os.family or with sys::family() from the sys module. Every function returns Result[…, string]. A key is a hive-prefixed path such as HKLM\Software\Vendor\App; the hive names are also available as the constants registry::HKLM, HKCU, HKCR, HKU and HKCC.
read
read
Reads a value. It returns None when the key or the value is absent. The Value is typed by the registry kind of the entry.
| Registry kind | Value |
|---|---|
| REG_SZ, REG_EXPAND_SZ | Value::String |
| REG_DWORD, REG_QWORD | Value::Int |
| REG_MULTI_SZ | Value::List of Value::String |
write
write
Writes a value. kind selects the registry type and must match the shape of value: sz and expand_sz take a string, dword and qword take an int, and multi_sz takes a list of strings.
delete_value
delete_value
Deletes one value from a key.
create_key and delete_key
create_key
delete_key
create_key creates a key and any missing parents. delete_key deletes a key and its whole subtree.
key_exists
key_exists
Whether a key exists.
use registry
use value
let key = "HKLM\\Software\\Vendor\\App"
match read? Some => if v.as_int == Some else ,
None => Ok,
}
}