I am trying to set and unset registry with values 1 and 0 respectively. I am using regedit npm package to achieve this.
Upon unset,I want this registry value to be 0. I see the function UnsetRegistryValue being called, but it doesn't set the value to 0.
Please note, already registry value set to 1. I want to replace registry value
**set registry **
function setRegistryValue(){
regedit.putValue({
'HKLM\System\CurrentControlSet\Control\Session Manager\Environment': {
'XYZ': {
value: '1',
type: 'REG_SZ'
},
'Version': { }
}
}, function(err) {app.console.log(err);});
}
**unset registry **
function UnsetRegistryValue(){
regedit.putValue({
'HKLM\System\CurrentControlSet\Control\Session Manager\Environment': {
'XYZ': {
value: '0',
type: 'REG_SZ'
},
'Version': { }
}
}, function(err) {app.console.log(err);});
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…