Skip to content

$cs.Reg_CreateKey

Creates a registry key at the given path, automatically creating any missing parent keys along the way. If the key already exists, nothing happens.

$cs.Reg_CreateKey(string regroot, string regpath)

Root hive: HKLM/HKEY_LOCAL_MACHINE, HKCU/HKEY_CURRENT_USER, or HKU/HKEY_USERS.

Registry key path to create, relative to regroot. Missing parent keys are created automatically.

None.

Terminal window
$cs.Reg_CreateKey('HKLM', 'SOFTWARE\7-Zip')

Creating a nested vendor/product key structure to hold app-specific configuration, even though none of the parent keys exist yet.

Terminal window
$cs.Reg_CreateKey('HKLM', 'SOFTWARE\Contoso\AppSuite\Licensing')
$cs.Job_WriteLog("Created Licensing configuration key")

Creating a per-feature subkey during PostInstall so later steps can write feature-specific settings into it.

Terminal window
$cs.Reg_CreateKey('HKLM', 'SOFTWARE\Contoso\AppSuite\Features\Reporting')
$cs.Reg_SetDword('HKLM', 'SOFTWARE\Contoso\AppSuite\Features\Reporting', 'Enabled', 1)

$cs.Reg_ExistKey $cs.Reg_DelTree $cs.Reg_SetString