Making changes to the registry using a REG file. Windows Basics of working with the registry - syntax, structure of the reg file Text file with the extension reg

Files with the extension reg needed to quickly make changes to the Windows registry (a kind of system-wide set of settings, configurations and parameters). For example, you can quickly remove the trash can from the desktop or disable the Caps Lock key (for example, it bothers me).
1. To create a file with the extension .reg, right-click on an empty area of ​​the folder or desktop, point to the “New” group and select “Text Document”.
2. You will be offered a standard name, something like "Text document.txt". Enter the required name for the new file, for example, for the already mentioned article “How to disable the recycle bin and remove it from the desktop,” create a file with the name korzina.reg.
3. Confirm the extension change.

4. That’s it, a new file with the .reg extension has been successfully created.
5. To add commands and parameters to it, right-click on it and select edit.

6. The editor will open. Make the necessary changes and save the file by pressing Ctrl+S or select the "File" menu in the top panel, then the "Save" command.

7. To make changes to the registry, double-click our reg file, or right-click on it and select the first item “Merge”. Agree with the warning about changes to the registry.

So, how to create a file with the extension . reg?

Let's look at everything in order. First, we need to make sure that in Windows XP/Vista/7/8 the function for hiding extensions of registered file types is disabled. Next we will show you how to do this (see below):

1) Click Start and choose Control Panel

2) In the window that appears, select Design and personalization(after setting in the line View: category)

If you have set the parameter large or small icons:

then we're just looking Folders settings Let's go straight to point 4.

4) You will see this window:

Go to the tab View, scroll the list to the very end and look for the line Hide extensions for registered file types, and uncheck the box.

Click OK and close all previous windows. Now we see file extensions. For example, a text document will have the extension .txt at the very end of its name.

5) Now let's start creating reg file

Right-click on the desktop (or any folder)

select in the context menu Create ---> Text Document

syntax, reg file structure​


____________________
what is a reg file?
This is a file that contains information for interacting with registry elements.

Attention!
Before you do anything, be sure to back up your registry!!!

___________________________________________________

So, the most common tool for working with the registry is the utility regedit.

With its help we can perform all the necessary operations.
Creation, modification, saving, import, export, deletion and other operations with system registry objects.

Shall we try?
Let's create our own command in the context menu.
To do this, open the section

Code:

HKEY_CLASSES_ROOT\DesktopBackground\Shell

Create a section called name.
there is another section in it - command.

In chapter name-create a string parameter - reg_sz
and give it any value - for example

Code:

My first bullshit...

My sick imagination got sick of this name, you are free to choose yours...

And in the section command create a similar string parameter with the name of the command to be executed.
It got into my head regedit.exe
As a result, we received the following context menu command when right-clicking:

By clicking we call up the registry editor...

You can simplify your task by using registry tweak.

Yes...
You don’t have to mess around with the registry editor, but simply enter the necessary information into the registry using a file with the extension .reg

What does this look like in practice?

If all the described operations write to reg file, then we get the following:

Code:

Windows Registry Editor Version 5.00 @="my first piece of garbage..." @="regedit.exe"

Any text editor is suitable for creating a reg file.
I took the notepad.
So, let's create a new test document.
In the previous example, we added new settings and keys to the registry.
Let's remove them now.
To do this, enter in a text document:

Code:

Windows Registry Editor Version 5.00 @="my first bullshit..."=- [-HKEY_CLASSES_ROOT\DesktopBackground\Shell\name\command] @="regedit.exe"

Save as - all files - name with extension .reg (for example tweak.reg)
Double click on the received file, apply, ok.
Let's look at the registry and see that the command section has been deleted, and in the name section the parameter that we previously created has been deleted.
Now it's time to figure out the syntax.

Code:

Windows Registry Editor Version 5.00

required line - indicates the editor version.

Registry_editor_version - either “Windows Registry Editor Version 5.00” for Windows 2000, Windows XP and Windows Server 2003, or “REGEDIT4” (letters must be capitalized) for Windows 98 and Windows NT 4.0. The REGEDIT4 header can also be used on computers running Windows 2000, Windows XP, and Windows Server 2003.

2)
The next line must be empty.

Code:

Note:
If the partition does not exist, it will be created.
If it exists, the parameters or changes contained in the tweak will be added to it.
In other words, the element will be overwritten.

4)
Parameter name is the name of the data parameter being imported. If a file's data element is not in the registry, the REG file adds it (with a value). If the data item exists, the value in the REG file overwrites the existing value. The data element name is enclosed in quotation marks. The data item name is followed by an equal sign (=).

5)
Value, parameter type

REG format files can be opened with special programs. There are 2 types of REG formats, each of which is opened by different programs. To open the desired type of format, study the file descriptions and download one of the proposed programs.

.REG file extension

Stores the registration key, serial number, and other user registration information for a specific program. Created upon completion of registration. It is referenced by the program when opened to identify the user, but the file should not be opened manually.

Download the program for REG format

When launched, it updates the Windows Registry. Standard REG files can be created to modify various aspects of Windows. To create your own registry update file, follow these directions:

1. Run Regedit (Select Run from the Start menu, type "Regedit")

2. Select the register section you need to change

3. From the File menu, select Export

4. Select the "Selected Branch" option in the Export Range at the bottom of the window.

5. Save the file with the extension ".reg".

Note: Manually updating the Windows registry is a more advanced process and should only be attempted if you know exactly what to do. Incorrectly updating the registry can cause Windows errors.

How to open a REG (Registry File) file

This article outlines the basic principles of working with the Windows registry, knowledge of which will be useful to you in customizing the operating system using registry tweaks.

Terminology

Before we get down to business, we need to define the terminology. I'm using official Microsoft terminology, so the terms are fairly consistent with Registry Editor items.

Figure 1 - Registry Editor

As you can see, there are no “branches” or “keys” here. Now to the point.

REG file

A REG file is a text file with a REG extension, compiled in a specific format.

REG file format

Below is an example of a REG file that disables the recent documents menu.

Windows Registry Editor Version 5.00 ;Disable the recent documents menu "NoRecentDocsMenu"=hex:01,00,00,00

Creating a REG file

Creating a REG file is very simple. Copy the code into any text editor (for example, Notepad). Press CTRL+S and save the file with any name and extension.reg, putting both in quotes to avoid txt extension.

Figure 2 - Creating a REG file

REG file syntax

  • Windows Registry Editor Version 5.00— the file header, which is an integral part of it. You can also see REGEDIT4 as a header - this is the Windows 98 / NT 4.0 format, which, however, will also be understood by newer Windows operating systems. More information about the differences in formats can be found on the JSO FAQ website (in English).
  • ;Disable recent documents menu- a comment. All lines starting with ; (semicolon) represent comments.
  • is a registry key. Graphically (in the Registry Editor) it represents the path to the parameter. In REG file format, sections are always enclosed in square brackets. In this example, the Explorer (sub)key belongs to the HKEY_CURRENT_USER key.
  • "NoRecentDocsMenu"=hex:01,00,00,00— registry parameter and its meaning. Depending on the value of the parameter, the behavior of the operating system or object changes. Many parameters can be configured in the operating system GUI, but not all. In such cases, registry editors, tweakers, or REG files are used to change the parameter.

A REG file can contain multiple registry keys and settings, but the header is only used at the very beginning.

Windows Registry Editor Version 5.00 ;Disable reboot in case of BSOD "AutoReboot"=dword:00000000 ;Disable notification on the welcome screen about unread messages "MessageExpiryDays"=dword:00000000

This REG file was obtained by exporting from the registry editor regedit.exe. Using REG files, you can make changes to the system registry - this operation is called importing registry settings.

Exporting registry settings

Exporting registry settings is an easy task. As a rule, settings are exported before making changes to the registry (backup), or in order to create a REG file for subsequent import into the registry of another computer or during an automatic system installation.

You can export registry settings in a variety of ways.

Windows Registry Editor (regedit.exe)

Windows OS includes a program for editing the registry - regedit.exe. Since it is located in the system directory, you do not need to specify the full path to run it on the command line (for example, the following sequence will suffice: Start - Run - regedit - OK).

In order to export a registry key, just right-click on it and select the command from the context menu Export(in Windows 2000 this command is located in the menu File).

Other registry editors

There are a great many programs for making changes to the system registry, which also have the ability to export settings. If you often work with the registry, then you will probably need a program that has an address bar. You can paste a copied registry key (from an article or from a forum post) into the address bar and quickly navigate to the desired setting. An example of such a program is RegWorks.

Command line

From the command line, you can export registry settings using the command REG EXPORT, which has the following syntax.

REG EXPORT Full path to the registry key in the form: ROOT\Subkey (for local computer only). Root partition. Values: [ HKLM | HKCU | HKCR | HKU | HKCC]. The full path to the registry key in the selected root partition. The name of the disk file to export. Examples: REG EXPORT HKLM\Software\MyCo\MyApp AppBkUp.reg Exports all subsections and parameter values ​​of the MyApp section to the file AppBkUp.reg

Importing registry settings

There are several ways to import registry settings.

Running a REG file using the GUI

This is the easiest way. It consists of running a REG file containing the necessary parameters by double-clicking or from the command line.

Double click

As trivial as it sounds, you can make changes to the registry by double-clicking on the REG file. However, first the system will clarify whether you really want to do this. If the answer is positive, changes will be made.

Figure 3 - The system requests confirmation to make changes.

Because of this query, this method is not suitable for importing settings into the registry during a silent system installation. But there are other ways.

Command line

To import REG files from the command line, there is a command REGEDIT. By typing at the command line

REGEDIT C:\hklm.reg

You will get exactly the same dialog box as when you double click. You can suppress the appearance of the dialog box by running the command with the parameter /S. This is the method most often used during automatic installation of Windows.

REGEDIT /S C:\hklm.reg

REG ADD command

Using the command REG ADD You can also import registry settings. It is convenient because the commands for importing parameters can be included in a batch file that also performs other tasks (i.e., there is no need for an additional REG file). For example, this command is often used to import registry values ​​into the RunOnceEx key and then install programs the first time you log on. The command syntax is quite simple - see it yourself by running the command on the command line REG ADD.

INF file

You can also import settings into the registry using INF files. Their general syntax is somewhat more complex than that of REG files, but writing directly to the registry is quite simple. Below is an example from the Msgina addon

Signature="$Windows NT$" Msgina OptionDesc="Msgina" Tip="GINA Login Library" Modes=0,1,2,3 AddReg=Msgina.AddReg HKLM,"Software\Policies\Microsoft\Windows\System\ Shutdown","ShowHibernateButton",0x10001,1 HKLM,"Software\Policies\Microsoft\Windows\System\Shutdown","HibernateAsButton",0x10001,1

Note. More information about INF files can be found in .