kessler / node-regedit

Read, Write, List and do all sorts of funky stuff to the windows registry using node.js and windows script host
MIT License
279 stars 45 forks source link

regedit is either undefined or returns unknown error code 1 for electron #115

Closed eaugustin2 closed 11 months ago

eaugustin2 commented 1 year ago

I'm trying to have regedit create a key in HKCU, however I constantly get undefined as the error in the callback. Prior to this I was getting alot of vbsscript unknown error code 1 messages.

My declaration for regedit is as follows: import regedit from 'regedit'; regedit.setExternalVBSLocation('resources/regedit/vbs'); Or

import regedit from 'regedit'; const vbsPath = path.join(path.dirname(remote.app.getPath('exe')), 'resources/regedit/vbs'); regedit.setExternalVBSLocation(vbsPath);

The way I use regedit is also as follows: await regedit.createKey(['HKCU\\SOFTWARE\\path_to_folder'], function(err, result) { console.log('err for create key: ', err); console.log('result: ', result); }) Or

regedit.createKey(['HKCU\\SOFTWARE\\path_to_folder'], function(err, result) { console.log('err for create key: ', err); console.log('result: ', result); })

Both cases yield the same results and i'm not sure where the issue is. Is there supposed to be files at the end of the setExternalVBSLocation path? If so please direct me to them, if not what might be the issue in this case?

I'm operating on Windows 10, Electron 12.2.3, node 14.17.0.

I've also read and implemented #60 , however still no avail

pspaulding commented 1 year ago

I was running into the same issue. Don't know if this helps or not, but I eventually determined that it was because I was attempting to put invalid (negative) REG_DWORD values. Limiting my values to positive numbers fixed the problem. So, make sure that the values that you are attempting to put make sense.