5

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

Dinesh
  • 1,825
  • 5
  • 31
  • 40

2 Answers2

8

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
Andrzej Karpuszonak
  • 8,896
  • 2
  • 38
  • 50
6

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) {
    ...
})
Yaniv Kessler
  • 838
  • 8
  • 10
  • 1
    Note that this module requires work if using in something like Electron, where your assets get bundled, as this uses an file type that can't be bundled and has to be shipped separately outside of the final package. – Dan P Jul 18 '22 at 08:17