HowTo: Registry Hacks by Script
If you want to modify or add keys to your registry using scripts instead of regedit.exe, follow the steps in this tech recipe.
In addition to learning all I can about programming, I enjoy customizing my registry. However, modifying individual keys can be a long and tedious process if you are not familiar with regedit.exe.
Since most of you will probably just be copying registry keys, locations, and values from sites such as this, here is how to add them without the hassle of using regedit.
Using scripts only requires notepad.exe or a similar basic text editor.
-Each script must start with the declaration regedit4. This declares regedit is the target of the keys to add them.
-The file must be saved with a .reg extension, not the .txt that is standard with Notepad.
I will design a useless key addition which will show up. I will tell you where at the end. In future registry hacks, I will also add the script version of the modification.
*You may wish to open regedit and follow along with each addition to see that it actually does what I claim.
With those basics out of the way, here is how to add keys to your registry.
First, define the path of the new folder or folders:
*Since the folder BackDoors.§ does not really exist, this will create it.
It will also add a default registry key to the folder to define it as a registry value. We need not worry about this value.
Add Registry Path:
This is where you want your key or folder to point. In most cases, this is not necessary. To be thorough, I am including it. We will use it to make it a member of a Windows GUI list.
Note that the type and path are in ” “. Since the path is a string, it also requires\\ to represent \ which is similar to most programming languages.
Since this example is adding to a GUI list, it will require the following, which is also needed for keys implementing the RegPath listed above.
Text or Title:
"Text"="Does Nothing... Absolutely Nothing. §"
Based on the location of appearance, this calls for a check box.
The value requires a name of the following convention 245FF040-5081-101B-9F07-00AA002F954E to be implemented by the RegPath above.
*Since I do not know if a random value will apply to something important or not, I have opted for the case of this useless box to leave the key empty, but you will see the value it creates in the registry.
Assign Checked and Unchecked Values:
*Since it is a check box, it requires both definitions:
*Also, notice here, that after the name of the key entry, the type is defined and set = equal to its key value.
Assign A Default Value:
Since we are creating the key, we need to initialize it. You may pick either checked or unchecked for this. (I have chosen unchecked.):
Display the Item in List:
This last key is a formality to tell Windows where to put our key for this example:
*Do not worry about the value assigned to this key. There are many possible values pending the location.
That is it. Now, as promised, you will see the results of this script:
In a Windows Folder Window, under Tools\Folder Options\, click on the View tab.
The values here are in alphabetical order, so look for the string placed into the Text key. It also has a check box beside it. This key does not do anything, but that can easily be changed knowing the proper ValueName and applying an appropriate Text to this GUI entry.
The Full Script:
"Text"="Does Nothing... Absolutly Nothing. §"
*Keep in mind that many scripts can be added to a single file. The lead line REGEDIT4 need only be written once.
*For good coding practice, multiple entries which do different tasks should be separated by a blank line, and grouped keys should be left together.
-William. § (marvin_gohan)
Follow the reactions below and share your own thoughts.