To add a Registry Entry from cmd using regedit, create a *.reg file containing the data you want to add. Simple example:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\TestKey]
"TestDWORD"=dword:00000123
and then execute this: regedit /s myreg.reg
This adds a Key (displayed like a folder in the regedit browser) named TestKey to HKEY_CURRENT_USER\Software. The TestKey Key contains a DWORD entry named "TestDWORD" that contains 123 in hex (291 in decimal)
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\TestKey]
"TestDWORD"=dword:00000123
[HKEY_CURRENT_USER\Software\TestKey\SubKey]
"StringEntry"="StringValue"
This creates TestKey @ HKEY_CURRENT_USER\Software plus a sub-key "SubKey" of TestKey with a String Entry (named "StringEntry") and value of "StringValue"
There's a simple way to find out how to create different kinds of entries: Use the regedit gui to create the desired entries, then mark the key and use the Menu File -> Export. The generated file will contain the key(s) and it's entries.
To create a Registry Entry in C#: http://msdn.microsoft.com/en-us/library/h5e7chcf.aspx