Write

Write is a function used to write values to registry keys.

Syntax

Write(Path, ValueName, Value)

Returns

No data returned.

More Information

Use the following declaration to achieve the correct value type:

  • Long - if registry value is REG_DWORD
  • String - if registry value is REG_SZ
  • Array of Strings - if registry value is REG_MULTI_SZ

Arrays need to be declared as variants and then value assigned to them using the array() function. Example:

Dim test as variant

Test = array(10,2,10)

If the key does not exist, it will be created.

Example

This script writes the value “test” to the following key: SOFTWARE\Microsoft\testkey\testsubkey:

Function Main

Dim Ro As Object

Dim test As String

test = "testvalue"

Set Ro = Registry.Connect("127.0.0.1")

ro.write "SOFTWARE\Microsoft\testkey", "testsubkey",test

End Function