9.2.2 RegWrite (enter a value in the registry)
- Purpose
-
Enter a value in the registry.
- Syntax
RegWrite(RegKey, SubKey, [EntryName], [Value] [, Type])
- Arguments
-
- RegKey
-
Specify the registry key as one of the following:
-
HKEY_CLASSES_ROOT
-
HKEY_CURRENT_USER
-
HKEY_LOCAL_MACHINE
-
HKEY_USERS
If you specify a registry key other than HKEY_CURRENT_USER, execute the script file as a user who has administrator permissions. For details, see 1.8.3 Effect of the executing user on command behavior.
-
- SubKey
-
Specify the registry subkey as a character string or as a variable that stores this value.
- EntryName
-
Specify the entry as a character string or as a variable that stores this value.
This value is optional. If you omit this value, a value without an entry name is assumed.
- Value
-
Specify the value to be written to the registry. Write a string or number, or a variable that stores this value.
This value is optional. If you omit this value, a zero-length string or 0 is assumed.
- Type
-
Specify the type of the value to be written to the registry as one of the following:
-
REG_DWORD
-
REG_DWORD_BIG_ENDIAN
-
REG_EXPAND_SZ
-
REG_SZ
This value is optional. If you omit this value, REG_SZ is assumed.
-
- Description
-
The RegWrite command writes a value to a specified registry entry. The command returns True on successful execution, or False if an error occurs. The entry is created if no such entry exists.
- Important
-
If the type of the value to be written to the registry is REG_SZ or REG_EXPAND_SZ, a string consisting of no more than 1,024 bytes can be entered for the value. If you specify a string consisting of 1,025 or more bytes, the 1,025th and subsequent bytes are ignored.
- Example
RegWrite(HKEY_CURRENT_USER _ ,"Software\Hitachi\Script", "CurrentVersion" _ ,"0100", REG_SZ)
- JP1/Script version
-
Supported from JP1/Script 01-00.