Adds a new value called value_name, of the specified type in the Registry.
If keypath or value_name contain spaces, enclose them in quotes.
keypath is the full path to the key containing the value. You can abbreviate HKEY_LOCAL_MACHINE to HKLM and HKEY_CURRENT_USER to HKCU.
type can be BINARY, MULTI, STRING, WORD.
Type |
Meaning |
---|---|
BINARY |
Specifies a string of twin hexadecimal values. (Registry type REG_BINARY) Example:
REG BINARY HKCU\Software\sunw\cc\1.0\sunwnfs Binary_test 7465737400 |
MULTI |
Specifies a set of strings separated by spaces. (Registry type REG_MULTI_SZ) Example:
REG MULTI HKEY_CURRENT_USER\Software\Netscape\MyKey Srtings "My telephone number is 1234567" adds the strings My, telephone, number, is, and 234567 to the value Strings. |
STRING |
Specifies a string. (Registry type REG_SZ) Example:
REG STRING HKEY_CURRENT_USER\Software\Netscape\MyKey test Hello adds the string Hello to the value test. |
WORD |
Specifies a integer in decimal or hexadecimal format. (Registry type REG_DWORD) Note: When a decimal number is entered it will be converted to hexadecimal and stored. When read back it will be in hexadecimal format, and leading zeros will be added to look exactly as it does in the Registry. Example of writing a decimal value:
REG WORD HKCU\software\netscape\MYKey MyValue 4294967295 SET errorcode=%SNERRORLEVEL% IF NOT "%ERRORCODE%" == 0 GOTO ERROR Example of reading the same value:
SET REG readvalue=HKCU\software\netscape\MyKey MyValue NOTSET IF NOT ERRORLEVEL 0 GOTO ERROR2 ECHO Value read is "%READVALUE%" |