3

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
  • 604
  • 2
  • 9
  • 22
  • are you able to add the value manually, through regedit? or else, you might not have permission to do so.. – tumchaaditya Jun 18 '12 at 06:56
  • Yes, I've been able to create reg. values using everything but a batch file. – Usta Jun 18 '12 at 20:46
  • 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 Jun 18 '12 at 20:56

1 Answers1

7

Add quotation marks around the subkey

REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /v "MyCustomWorkgroupUsername" /t REG_DWORD /d 0
iglvzx
  • 23,609
Usta
  • 604
  • 2
  • 9
  • 22