electron截屏失效修改注册表

92 阅读1分钟
    //更新注册表
    updateRegistry(){
        //修改路径
        const registryPath = 'HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System';
        const registryKey = 'EnableLUA';
        const registryValue = '0';
        
        const command = `reg add "${registryPath}" /v "${registryKey}" /t REG_DWORD /d ${registryValue} /f`;

        exec(command, (error, stdout, stderr) => {
            if (error) {
                console.error(`Error modifying registry: ${stderr}`);
            } else {
                console.log(`Registry modified successfully: ${stdout}`);
            }
        });
    }