New functions for handling the Registry
Apr 4, 2023
0
521
Improving the reg
function and adding a new reg.exists
, reg.get
, reg.set
, reg.delete
functions.
The first parameter, which is the root key, was combined with the subkey path into one parameter to be compatible with REG COMMANDS.
The keyname must include a valid root key. Valid root keys for the local computer are:
HKCU
HKCR
HKLM
HKU
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
REG.EXISTS
Check that the key name exists
reg.exists('HKCU\Control Panel\Desktop')
Check that the value name exists
reg.exists('HKCU\Control Panel\Desktop', "WallPaper")
REG.GET
Read data by value name
reg('HKCU\Control Panel\Desktop', "WallPaper")
reg.get('HKCU\Control Panel\Desktop', "WallPaper")
reg.get('HKCU\Control Panel\Desktop')
REG.SET
The reg.set
function allows creating a subkey with the value name and value data
Create Subkey
reg.set('HKCU\Software\Nilesoft\Shell')
Create Subkey with value and set value data type
reg.set('HKCU\Software\Nilesoft\Shell', "test-int", 1, reg.dword)
reg.set('HKCU\Software\Nilesoft\Shell', "test-str", 1, reg.sz)
reg.set('HKCU\Software\Nilesoft\Shell', "test-str", 'some string', reg.sz)
Set value data with auto type detection
reg.set('HKCU\Software\Nilesoft\Shell', 'test-auto-int', 1)
reg.set('HKCU\Software\Nilesoft\Shell', 'test-auto-str', 'some string')
REG.DELETE
The reg.delete
function allows deleting a subkey or deleting a value
Delete value name
reg.delete('HKCU\Software\Nilesoft\Shell', 'test-auto')
Delete subkey
reg.delete('HKCU\Software\Nilesoft\Shell')
Leave a comment...