Manage the registry in command line

Last update on July 22, 2009 11:36 AM by jak58
Published by jak58

Manage the registry in command line





Here is how to manage the registry using the command line (REG command). These mainupalitions are useful when you are facing an infection that prevents access to the registry or when you want to create a batch that modifies the registry.

Opening a command prompt


To begin, you must run the command prompt with the highest privileges:
  • XP:

Start Menu> Run
Type cmd and validate
  • Under Vista:

Start Menu> All Programs> Accessories
Right-click Command Prompt> Run as administrator

To get more information about the REG command.

Just add /? after the command.

Examples:

REG /?
REG ADD /?
REG COPY /?

Adding an Item



Add a Key


REG ADD [location of the key]\[name of the new key] 

Add a value


REG ADD [location of the new value]/V[value name]/T [value type]/D [value data] 



The /T is to specify the type of value to add. There may be six types of values:
REG_SZ
REG_MULTI_SZ
REG_EXPAND_SZ
REG_DWORD
REG_BINARY
REG_NONE

Add default value


REG ADD [location of the new value]/VE/D [data value]

Deleting an Item



Delete a key


REG DELETE [key name] 


Removes the selected key and all sub keys and values it contains.

Remove a value


REG DELETE [key name]/V[value name] 

Delete the default value


REG DELETE [key name]/VE 

Notes


It's important that you make up a backup of the registry before modifying it.
Best answers for « Manage the registry in command line » in :
Start/stop a service using command line Show Start/stop a service using command line The netsh tool (netsh.exe) can automate the startup or shutdown of a service through the following command line: To start a service: Net start name_of_service To stop a service:...
Enable/disable a device from the command line Show Enable/disable a device from the command line Install Devcon Display all the devices in the system Enable/disable the device Other devices Here is a trick that allows you to enable / disable a device from the command line in XP....
List of open ports in command line Show List of open ports in command line Whether you're running Windows or Linux / Unix, the following command in (console) will display the list of open ports on your computer: netstat -a For the use of advanced graphics tools, see What...
Enabling/Disabling the firewall using command line ShowEnabling/Disabling the firewall using command line Disable Windows XP firewall Enable the Windows XP firewall Under Windows XP SP2, it is possible to enable/ disable the firewall with the following command lines: Disable Windows XP...
[Linux]Restarting the network interface using command lines Show[Linux]Restarting the network interface using command lines When setting up a network, specially if you need to verify that a DHCP server assigns IP addresses correctly, restarting the network interface using command lines rather than the...
[Windows XP] Repairing the network connection using command line Show[Windows XP] Repairing the network connection using command lines Under Windows XP there is a small feature allowing you to repair a network connection. Go to the Network Connections options in Control panel (Control Panel / Network...
Download 7-Zip Show7Z also known as 7Zip archive utility is available as open source and is free to use. 7Z is fast, efficient and free. Features: High compression ratio in new 7z format with LZMA compression 7-Zip is free software distributed under the GNU...
UNIX system - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence its name "shell". The shell therefore acts as an intermediary between the operating system and the user using command lines...
Cmd - cmd.exe Showcmd - cmd.exe cmd.exe (cmd signifiant Windows Command Prompt) is a Windows NT/2000/XP generic process which opens a text-mode console for running programs using a command line. The process cmd is not in any way a virus, a worm, a Trojan horse,...
Linux - The shell ShowIntroduction to the shell The command interpreter is the interface between the user and the operating system, hence the name "shell". The shell therefore acts as an intermediary between the operating system and the user thanks to command lines...