Complete reg registry File Parsing

Source: Internet
Author: User
When we set or modify the registry, sometimes a file with the reg extension may be used. What is this file? What does it do? How can we create it and perform various operations on the registry? I will give you one by one!

What is it?

The reg file is actually a registry script file. You can double-click the reg file to import the data to the Registry. Token is disabled, so the function is more powerful and flexible. In addition, the reg file can be opened, edited, and modified in any text editor \ (such as NotePad, when an error occurs, you can change the data in the reg file and then import the data to restore it. Therefore, it is more convenient and secure.

How?

The reg file can be used to perform the following operations on the registry: Create a primary key, delete a primary key, create a new key value, modify a key value, and delete a key value. The following is an example of the actual operation in Windows/XP.

1. Create a primary key

For example, we want to create a primary key named "new primary key name" under the primary key [HKEY_CURRENT_USER \ soft-ware. Then, open notepad and write the following content:

WindowsRegistryEditorVer-sion5.00 [HKEY_CURRENT_USER \ Software \ new primary key name]

After the input is complete, save it as a file, such as "*. Reg", and double-click it to import it to the Registry. As shown in 1, we can see the effect after modification.

2. Delete the primary key

You must use the reg file to delete a primary key in the registry by adding a-symbol before the primary Key Path in. It is worth noting that the delete primary key operation will delete all the subkeys and their key-value items under the primary key. For example, to delete the primary key we just added, enter the following content in Notepad:

WindowsRegistryEditorVer-sion5.00

[-HKEY_CURRENT_USER \ Software \ new primary key name]

Next, you only need to save it as a *. reg file and double-click it to import it to the Registry to take effect immediately.

3. Create a key value

Right-click the reference content in the blank window of the key-value items on the right of the Registry Editor, and select the new menu item. You can see that these key values are subdivided: string Value, binary value, DWORD value, and other types.

String Value (reg_sz), which is generally used as a file description and hardware identifier. It can be letters, numbers, or Chinese characters, but it is a fixed-length text string, the maximum length is 255 characters. The reg file is generally "A" = "*****". Binary value (reg_binary). Generally, most hardware component information is stored in binary data and displayed in Registry Editor in hexadecimal format. There is no length limit for this type of value. It can be any byte length. The reg file generally shows "A" = HEX: 01,00, 00,00.

Dwoed value (REG_DWORD). Many parameters of the device driver and service are of this type and are displayed in the Registry Editor in binary, hexadecimal, or decimal format. Reg files are generally represented as "a" = DWORD: 00000001.

If your operating system is win-dowsxp, in addition to the string value, binary value, and DWORD value, you may also see two types of key-value: Multi-string value and extensible string value. We have learned about common key values and their format in Reg files. Next we will take a look at how to create a key value.

To create a new key-value item, you must specify the branch of the key-value, the name of the key-value, the type of the key-value, and the value of the key-value \ (data \. For example, to create a primary key named reg file test under the branch [HKEY_CUR-RENT_USER \ Software] and set the default key value to test ", add the "string" key value item \ (string value \, "binary" key value item \ (binary value \, "Double Byte" key value item \ (DWORD Value \. You can write as follows:

WindowsRegistryEditorVer-sion5.00

[HKEY_CURRENT_USER \ Software \ reg file test]

@ = "Test" "string" = "Ceshi" "dual Byte" = HEX: 01,00, 00000001 "DWORD Value" = DWORD: In the reg file, the DWORD value is represented by DWORD, And the binary value is represented by hex. The string value can be enclosed by quotation marks. It is worth noting that the key value types such as DWORD and hex must also be in lower case. In addition, if the string contains a path separator when creating a string key value, the path separator must be represented by a double slash. Also, in the reg file, the default key value is represented by @ and there is no quotation marks. As shown in figure 2, you can clearly see the corresponding relationship.

4. Modify the key value

The reference content can be used to modify a key-value item and create a new key-value. You only need to change the corresponding data in the reg file. For example, to change the value of DWORD in the previous example to 00000000, we can write as follows:

WindowsRegistryEditorVer-sion5.00

[HKEY_CURRENT_USER \ Software \ reg file test] "DWORD Value" = DWORD: 00000000 after we perform the import operation, the new data will automatically overwrite the old data. For example, in this example, 00000000 is automatically replaced with 00000001.

5. delete key values

You can also use the-sign to delete a key-value project from the reg file. You only need to place the-symbol after the equal sign of the key-value project. We want to delete the key-value items we have added in Figure 2. We can write them like this, as shown in Figure 3:

WindowsRegistryEditorVer-sion5.00

[HKEY_CURRENT_USER \ Software \ reg file test]

@ = "Test" "string" =-"dubyte" =-"DWORD Value" =-notice the minus sign after the equal sign. This is what deletion means.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.