Scripting Windows Registry Changes

This is something every power Windows user should know about automating changes to the Windows registry. Let’s just learn by example:

reg add HKLM\SOFTWARE\Atria\ClearCase\CurrentVersion /v Region /d MyClearCaseRegion /f

This adds the Region “Value Name” (/v), sets the “Value Data” (/d) to MyClearCaseRegion and forces it to overwrite an existing registry entry if one exists (/f).

All you have to do is look up the key you want to change using regedit.exe (Start->Run->regedit) and don’t forget to convert the top level directory name into a four-letter acronym. For example HKEY_LOCAL_MACHINE becomes HKLM. Here is a regedit screenshot showing the registry entry created with the above example.

That should cover 95% of your registry automation needs and for everything else there is:

reg /?

This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.