// you’re reading...

How in the Tech

Modifying a local or remote Windows registry through the command line

Here on How in the TECH I do a fair bit of registry tips that uncover additional functionality or features of Windows. They all start the same, from your Start Menu search and execute regedit, traverse the registry tree, and create the key/change the value in question. Clearly, it’s a very point and click driven process – so what if you wished to replicate a change across a network of computers? You are probably interested in learning how to manipulate the Windows Registry via the command line, which can then be integrated into batch files and initiated from your users network login scripts.

The command line program is logically abbreviated as reg and can be used to add and delete or export and import registry keys.

Executing reg /? uncovers all the available options with their appropriate syntax.

To add a new key Test underĀ  HKEY_Local_Machine\Software the syntax is as straight forward as it comes.

reg add HKLM\Software\Test

Logically, deletion is handled the same way; merely swapping add for delete

reg delete HKLM\Software\Test

Expanding, to modify values within keys requires a few more parameters on the command line. After creating the above key Test under HKLM/Software, let’s create a value TestValue with of type DWORD and data 1.

reg add HKLM\Software\Test /v TestValue /t REG_DWORD /d 1

All of the above commands can also be projected onto remote computers, assuming you have the same login credentials on both systems – just prepend \\computer_name to the key location.

reg add \\remote_computer\\HKLM\Software\Test

Related Posts with Thumbnails

Discussion

No comments for “Modifying a local or remote Windows registry through the command line”

Post a comment