Setting and unsetting registry using regedit (replace registry value from 1 to 0)

久未见 提交于 2019-12-11 14:05:55

问题


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);});

}


回答1:


Sorry, I had typo in the to set or unset or modify.You can use regedit.putValue



来源:https://stackoverflow.com/questions/56750842/setting-and-unsetting-registry-using-regedit-replace-registry-value-from-1-to-0

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!