Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create new windows system registry value

I want to create a new registry entry in Windows 7, set, read and edit the value of the registry key using Node.Js

like image 506
Dinesh Avatar asked Dec 20 '22 23:12

Dinesh


2 Answers

Check windows module

Few examples from the docs:

v = registry('HKLM/Software/Microsoft')  // wrapped in objects allowing further fluent commands
v.someValue.remove()                     // delete value
v.add('newValue', 'myValue')             // add new value
v.add('newKey')                          // a key is like a folder
v.subKey                                 // getter which goes down one level deeper

x = registry('HKCU/Some/Random/Place')
x.add('newName', v.someValue)            // clone a value
like image 90
Andrei Karpushonak Avatar answered Jan 07 '23 06:01

Andrei Karpushonak


Alternatively you can check regedit, here are some snippets from docs:

var regedit = require('regedit')

regedit.list('HKCU\\SOFTWARE', function(err, result) {
    ...
})

regedit.createKey('HKCU\\Software\\MySoftware\\foo', function(err) {
   ...
})

regedit.putValue({
    'HKCU\\Software\\MySoftware\\foo': {
        'myValue3': {
            value: ['a', 'b', 'c']
            type: 'REG_MULTI_SZ'
        }
    }
}, function(err) {
    ...
})
like image 40
Yaniv Kessler Avatar answered Jan 07 '23 06:01

Yaniv Kessler