Creates a key or value in the registry.
RegWrite ( "keyname" [,"valuename" [, "type" [, value]]] )
| keyname | The registry key to write to. If no other parameters are specified this key will simply be created. |
| valuename | [optional] The valuename to write to. |
| type | [optional] Type of key to write: "REG_SZ", "REG_MULTI_SZ", "REG_EXPAND_SZ", "REG_DWORD", "REG_QWORD", or "REG_BINARY". |
| value | [optional] The value to write. |
| Success: | Returns 1. |
| Failure: | Returns 0 if error writing registry key or value. |
| @error can be set to following values : | |
| 1 if unable to open requested key | |
| 2 if unable to open requested main key | |
| 3 if unable to remote connect to the registry | |
| -1 if unable to open requested value | |
| -2 if value type not supported |
; Write a single REG_SZ value
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey", "REG_SZ", "Hello this is a test")
; Write the REG_MULTI_SZ value of "line1" and "line2"
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey1", "REG_MULTI_SZ", "line1" & @LF & "line2")
; Write the REG_MULTI_SZ value of "line1"
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey2", "REG_MULTI_SZ", "line1")
; always add and extra null string
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey3", "REG_MULTI_SZ", "line1" & @LF & "line2" & @LF)
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey4", "REG_MULTI_SZ", "line1" & @LF & @LF & "line2" & @LF)
; empty REG_MULTI_SZ
RegWrite("HKEY_CURRENT_USER\Software\Test", "TestKey5", "REG_MULTI_SZ", "")
; create just the key
RegWrite("HKEY_CURRENT_USER\Software\Test1")