The regSetVal creates or sets a value for the registry key specified by sKey on the local system or a remote system. If the value identified by sValName does not exist, it is created, otherwise the existing setting is overwritten with the value.
The function has the following syntax:
regSetVal(sKey, sValName, value, [type])
Specifies the registry key.
Specifies the name of the value.
Defines the value.
Specifies the type of the value.
If the function fails, it raises an exception. Otherwise it returns true.
Examples
Set REG_DWORD value for key HKLM\Software\ACME named "Number" to 42:
regSetVal("HKLM\\Software\\ACME", "Number", 42);
Set REG_SZ value for key HKLM\Software\ACME named "Label" to "Hello" with error handling:
try { regSetVal("HKLM\\Software\\ACME", "Label", "Hello"); ? "Success" } catch(e) { ? "Failure:", e }
Set a REG_EXPAND_SZ value:
regSetVal("HKLM\\Software\\ACME", "MyPath", "%Path%;c:\\MyDir", REG_EXPAND_SZ);
Set a REG_MULTI_SZ value:
arr=["Alice", "Bob", "Carol"]; regSetVal("HKLM\\Software\\ACME", "People", arr);
Set string value on remote machine client8:
regSetVal("client8::HKLM\\Software\\ACME", "Name", "Bob");
Copyright © 2013 CA. All rights reserved. |
|