Batch Reg usage
Usage of Reg
Together there are the following 11:
REG QUERY
REG ADD
REG DELETE
REG COPY
REG SAVE
REG RESTORE
REG LOAD
REG UNLOAD
REG COMPARE
REG EXPORT
REG IMPORT
===============================================================================
Usage of REG add
REG ADD KeyName [/v ValueName |/ve] [/t Type] [/s Separator] [/D
Data] [/f]
KeyName [\\machine\]fullkey
Machine name of the remote machine-ignores default to current machine.
There are only HKLM and HKU on the remote machine.
FullKey ROOTKEY\SubKey
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key under the selected ROOTKEY
/v The Value name to add under the selected
/ve add a blank value name < No Name > for a registry key
/t RegKey data type
[REG_SZ | REG_MULTI_SZ | Reg_dword_big_endian |
REG_DWORD | REG_BINARY | Reg_dword_little_endian |
Reg_none | REG_EXPAND_SZ]
If omitted, the REG_SZ is used
/s specifies one of the REG_MULTI_SZ data strings
Character used as a separator
If omitted, "" is used as a separator
/d data to be assigned to the added registry ValueName
/f Force Overwrite existing registry key without prompting
For example:
REG ADD
Add a registry key on the remote machine ABC HKLM\Software\MyCo
REG ADD hklm\software\myco/v data/t reg_binary/d fe340ead
Add a value (name: Data, type: REG_BINARY, Date: fe340ead)
REG ADD hklm\software\myco/v mru/t reg_multi_sz/d fax\0mail
Add a value (name: MRU, type: REG_MUTLI_SZ, data: fax\0mail\0\0)
REG ADD hklm\software\myco/v path/t reg_expand_sz/d
%%systemroot%%
Add a value (name: Path, type: REG_EXPAND_SZ, data:%systemroot%)
Note: Use the double percent sign in the curried string (%)
===============================================================================
Usage of REG Query
REG QUERY KeyName [/v ValueName |/ve] [/s]
KeyName [\machine\]fullkey
Machine remote machine name-ignores the default value of the current machine
Only HKLM and HKU on the remote machine.
FullKey format is ROOTKEY\SubKey
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key under the selected ROOTKEY
/V Query specific registry keys
VALUENAME The name of the value to query under the selected item
When omitted, all values under the item are queried
/ve query default value or white space value name <no name>
/s query for all subkeys and values
For example:
REG QUERY hklm\software\microsoft\reskit/v Version
Displays the value of the registry value Version
REG QUERY hklm\software\microsoft\reskit\r
t\setup/s
Show all subkeys and values under Setup for a registry key
===============================================================================
Usage of REG Delete
REG DELETE KeyName [/v valuename |/ve |/va] [f]
KeyName [\\machine\]fullkey
Machine remote machine name-ignores the default value of the current machine
Only HKLM and HKU on the remote machine.
FullKey ROOTKEY\SubKey
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key under the selected ROOTKEY
The name of the value to delete under the VALUENAME option
When omitted, all subkeys and values under this item are deleted
/ve deletes the value of a blank value name <no name>
/va Delete all values under this key
/f Force Delete without prompting
For example:
REG DELETE HKLM\Software\MyCo\MyApp\Timeout
Delete registry key Timeout and all its subkeys and values
REG delete/v MTU
Remove the registry key MTU under MyCo on ZODIAC
===============================================================================
Use of REG copy
REG COPY KeyName1 KeyName2 [/s] [/f]
KeyName [\\machine\]fullkey
Machine remote machine name-ignores the default value of the current machine
Only HKLM and HKU on the remote machine.
FullKey ROOTKEY\SubKey
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key under the selected ROOTKEY
/s copies all subkeys and values
/f Force copy without prompting
For example:
REG COPY HKLM\Software\MyCo\MyApp hklm\software\myco\savemyapp/s
Copy all subkeys and values under the registry key MYAPP to the registry key SaveMyApp
REG Copyhklm\software\myco1
MyCo all values under the registry key on ZODIAC
Copy to the registry key on the current machine MyCo1
===============================================================================
Usage of REG Save
REG SAVE KeyName FileName
KeyName ROOTKEY\SubKey
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key under the selected ROOTKEY
filename of the disk you want to save. If you do not specify a path,
The file is created in the current folder of the calling process
For example:
REG SAVE HKLM\Software\MyCo\MyApp Appbkup.hiv
To save a hive MyApp to a file in the current folder Appbkup.hiv
===============================================================================
Usage of REG Restore
REG RESTORE KeyName FileName
KeyName ROOTKEY\SubKey (Local machine only)
Rootkey [HKLM | HKCU | HKCR | HKU | HKCC]
Subkey The full name of the registry key to which you want to restore the hive file.
Overwrite values and subkeys of existing items
FileName to restore the hive file name
You must use REG SAVE to create this file
For example:
REG RESTORE HKLM\Software\Microsoft\ResKit NTRKBkUp.hiv
Restore the file NTRKBkUp.hiv, overwriting the registry key Reskit
===============================================================================
Usage of REG load
REG LOAD KeyName FileName
KeyName ROOTKEY\SubKey (Local machine only)
Rootkey [HKLM | HKU]
subkey the name of the registry key to load the hive file into. Create a new registry key
FileName of the hive to load