2013-10-13 66 views

回答

6

檢查windows模塊

從幾個例子編輯註冊表項的值文檔:

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 
2

或者你可以檢查regedit,這裏有一些片段從文檔:

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) { 
    ... 
})