Add registry key via batchfile

3

0

I'm trying to create a registry key with a batch file. I really need to be able to do this via a batch rather than a VBscript or .reg file.

So far by using this guide, I've come up with this. but whenever I try to run it, I don't see it in the registry. (No errors, running as Admin) What am I doing wrong?

REG ADD HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList /v "MyCustomWorkgroupUsername" /t REG_DWORD /d 0

Usta

Posted 2012-06-18T04:29:53.817

Reputation: 504

are you able to add the value manually, through regedit? or else, you might not have permission to do so.. – tumchaaditya – 2012-06-18T06:56:40.567

Yes, I've been able to create reg. values using everything but a batch file. – Usta – 2012-06-18T20:46:06.910

Found the issue. Because there was a space in the subkey 'Windows NT', it was treating everything after that as parameters. Added quotations around my key fixed it. – Usta – 2012-06-18T20:56:56.720

Answers

6

Add quotation marks around the subkey

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v "MyCustomWorkgroupUsername" /t REG_DWORD /d 0

Usta

Posted 2012-06-18T04:29:53.817

Reputation: 504