Specifies the data component for the specified key. If the value
does not exist, the command creates the value.
This command requires the SYSPRV privilege or the REG$UPDATE
rights identifier.
Format:
CREATE VALUE key-name
key-name
Specifies the name of the key for which you will set the value.
1 – Qualifiers
1.1 /DATA
/DATA=value
The value can be one of the following:
o String (for example, /DATA=COSMOS)
o An array of strings separated by a comma and enclosed in
parentheses (for example, /DATA=(COSMOS,Noidea)
o A longword in binary, octal, decimal, or hexadecimal format.
%B, %O, %D, and %X, or 0B, 0O, 0D, and 0X prefixes specify
the format. The default is decimal.
Examples: /DATA=%X1A0FCB (hex)
/DATA=0X1A0FCB (hex)
/DATA=%D1234 (decimal)
/DATA=1234 (decimal, by default)
NOTE
You cannot specify the /INPUT qualifier with /DATA.
1.2 /FLAGS
/FLAGS=flag
Specifies the data flags value. This is an application-dependent
64-bit flag specified as a decimal number or as a hexadecimal
number preceded by 0x or %X.
1.3 /INPUT
/INPUT=filename
Specifies that the value data is to be read from a file.
The input value data can be specified in one of the following
formats. With the exception of SZ, the format is specified by a
keyword at the start of the file. The keyword can be entered in
uppercase or lowercase. Input records following a keyword can
span multiple lines; use "\" at the end of any continuation lines.
o SZ: a null-terminated Unicode string
Enter SZ data by enclosing the record in quotes. You do
not specify an SZ keyword for this input value type.
You cannot continue the quoted string to a second line.
"This is Unicode Data."
o DWORD: A 32-bit number.
The data following the DWORD keyword is interpreted as
a single, 32-bit value. It can be entered as a single
value or as a list of values, separated by commas, with
the least significant value first, provided the total
is 32 or fewer bits.
For example, the following valid specifications are
equivalent:
dword:44332211 DWORD:11,22,33,44 Dword:2211,4433
The following specifications are invalid because the total
always exceeds 32 bits:
dword:5544332211
dword:11,22,33,44,55
dword:2211,554433
o EXPAND_SZ: A string of Unicode characters. The data
following the EXPAND_SZ keyword is interpreted as a list
of 4-byte Unicode values. For example:
expand_sz:43,44,45
This example stores the Unicode string "CDE".
o MULTI_SZ: A concatenated array of SZ strings. The data
following the MULTI_SZ keyword is interpreted as a list of
4-byte Unicode values, specifying two or more terminated SZ
strings. For example:
MULTI_SZ:52,61,69,6e,00,53,6c,65,65,74,00,53,6e,6f,77,00
This example stores the Unicode strings "Rain", "Sleet", and
"Snow".
o HEX: Binary data. The data following the HEX keyword is
interpreted as a list of hex values. For example:
HEX:0F,C0,F0,FF
o DEC: Binary data. The data following the DEC keyword is
interpreted as a list of decimal values. For example:
DEC:15,192,240,255
o OCT: Binary data. The data following the OCT keyword is
interpreted as a list of octal values. For example:
OCT:17,300,360,377
o BIN: Binary data. The data following the BIN keyword is
interpreted as a list of binary values. For example:
BIN:1111,11000000,11110000,11111111
NOTES
o The input format is similar to the IMPORT and EXPORT file format.
o The input data type is independent of the data storage type, which
is specified by the /TYPE_CODE qualifier.
o When you specify a binary input type (HEX, DEC, OCT or BIN)
for each value in the record, the data is stored in the fewest
bytes possible. No alignment is performed. To insure proper
alignment, always enter any list of values as byte values.
This input should be a stream of byte values, with the
least significant byte first. For example:
DEC:253, 254, 255, 256, 257 (bytes/words, unaligned)
DEC:253, 0, 254, 0, 255, 0, 256, 257 (bytes/words, word aligned)
DEC:253, 0, 254, 0, 255, 0, 0, 1, 0, 2 (byte stream, word aligned)
o The input and storage types must be compatible. For example,
you cannot specify value type DWORD (which means that the
stored data is 4 bytes) and then input the SZ string "A"
because then the SZ string would consist of the character
00000041 and the terminator 00000000, which cannot fit in a
DWORD. Attempting this will result in a REG-E-INVDATA error.
However, specifying an empty string ("") does work and stores
just the terminator. Conversely, the input type DWORD specifies
an input data length of 4 bytes. You cannot specify value type
SZ and input type DWORD:00000041 because SZ strings must be
terminated. The only valid DWORD you can enter in this case is
00000000.
o When specifying /INPUT, you cannot specify the /DATA qualifier.
1.4 /LINK
/LINK=(TYPE=value, NAME=key-name)
Defines the key as a link to another key. The link value must be
one of the following:
o SYMBOLICLINK
o NONE
To remove a link, enter the following:
/LINK=(TYPE=NONE,NAME="")
1.5 /NAME
/NAME=string
Specifies the name of the new value.
1.6 /TYPE_CODE
/TYPE_CODE=type
Specifies the type of the new value. The type value must be one
of the following:
o SZ: a null-terminated Unicode string
o EXPAND_SZ: a string of Unicode characters
o MULTI_SZ: a concatenated array of SZ strings
o DWORD: a 32-bit number
o BINARY: raw binary data
1.7 /WAIT
/WAIT=seconds (default = 90)
/NOWAIT
Specifies the maximum amount of time, in seconds, that you are
willing to wait for command completion. If the Registry server
does not complete the request in the specified interval, REG$CP
returns REG-F-NORESPONSE. The default interval is 90 seconds.
/NOWAIT is equivalent to specifying /WAIT=0, but there may still
be a short wait period.
1.8 /WRITEBEHIND
/WRITEBEHIND
/NOWRITEBEHIND (default)
Specifies when the information can be written to disk.
/WRITEBEHIND specifies that the information can be written to
disk later. /NOWRITEBEHIND specifies write-through operation
(that is, the information must be written to disk immediately).
2 – Examples
REG> CREATE VALUE/DATA=COSMOS/TYPE=SZ/NAME=COMPUTERNAME -
_REG> HKEY_LOCAL_MACHINE\NODE
This example creates the COMPUTERNAME value for the key
HKEY_LOCAL_MACHINE\NODE and sets its type to SZ and its data
value to "COSMOS".
REG> CREATE VALUE HKEY_USERS\CVEX1/NAME=SZ-HEX/TYPE=SZ/INPUT=SYS$INPUT
HEX:41,00,00,00,42,00,00,00,43,00,00,00,44,00,00,00,45,00,00,00,\
46,00,00,00,00,00,00,00
This example creates the SZ-HEX value for the key HKEY_USERS\CVEX1
and sets its type to SZ. The data is entered as hex data. In this
particular case, the data equates to the Unicode string "ABCDEF".
It would be simpler to enter ABCDEF as a string. However, this
format provides the capability of entering any Unicode value,
including those you may not be able to input directly as a string.
$ CREATE POWERS2.DAT
DEC:2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768,65536,\
131072,262144,524288,1048576,2097152,4194304,8388608,16777216,\
33554432,67108864,134217728,268435456,536870912,1073741824
REG> CREATE VALUE -
HKEY_USERS\CVEX2/NAME=BIN-FILE/TYPE=BINARY/INPUT=POWERS2.DAT
This example creates data file POWERS2.DAT containing a series of
decimal values. Next the user creates the value BIN-FILE for the
key HKEY_USERS\CVEX2 and sets its type to BINARY. The raw binary
data is read from file POWERS2.DAT to BIN-FILE.