reg file does not run. reg utility - launch and edit the registry from the command line. reg command line utility, save command

In this article, we will look at the reg command line utility, which is responsible for working with the Windows registry, for example, launching the registry from the command line or editing the registry from the command line. The registry itself contains the basic settings of the Windows system (user and application profiles); it is a kind of heart of the system. In fact, the registry is just a set of binary files; they cannot be opened, run or edited in a regular way, especially while the Windows system itself is running.

Or regedt32, is designed to view and edit the system registry and its contents, and launching or editing the registry from the command line is carried out using reg utilities .

Below is a list of the five root partitions and their short names:

  • HKEY_CLASSES_ROOT (HKCR),
  • HKEY_CURRENT_USER (HKCU),
  • HKEY_LOCAL_MACHINE (HKLM),
  • HKEY_USERS (HKU),
  • HKEY_CURRENT_CONFIG (HKCC).

To view registry keys using the command line, you need to enter

reg query "SectionName"

The %SystemRoot%\system32\config folder contains five system files:

  • SYSTEM
  • SECURITY
  • SAM
  • SOFTWARE
  • DEFAULT

plus, in the Documents and Settings directory another “special” document is stored NTUSER.DAT. Editing or copying these resources using the standard method will not work - you need special utilities. However, you can back up the registry via the command line. To do this, you can use two functions – save and export. Let's start with the first one.

reg command line utility, save command

This command is useful at that moment if you need to save the registry, before, for example, editing the registry from the command line, so that in case of trouble it can be restored again. And so, the command itself has the following syntax:

reg save "SectionName" "FileName"

SectionName– specify the path to the partition to be saved, for example

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services

File name– here indicates the path to the hive file (registry hive) that needs to be created; it must have the extension .hiv, for example: “C:\regsave\services.hiv”. If you need to work with a remote system, then it is worth remembering that only the HKLM and HKU branches are remotely accessible. If you encounter difficulties when trying to view registry keys using the command line on a remote machine, for example, after entering the command:

reg query \\192.168.1.6\HKLM

view the contents of HKLM on a computer with IP address 192.168.1.6, an error like “Access denied” or “path not found” appears, then it’s worth checking:

  • Is the “Remote Registry” service running on the remote machine (the command line offers the utilities net start “ServiceName” and net stop “ServiceName”)
  • Is simple sharing open: Folder Options, uncheck " Use simple file and folder sharing »
  • Check whether access to the computer is allowed at all.
  • Is the password used in the administrator account? If not, then you should assign it ( Protection against empty passwords )

And, even after doing all this, it is quite possible that running the command will not produce results and access will be denied; executing the preliminary command helped me

tasklist /s 192.168.1.6 /u Username /p Password

here I launched t to view the running processes on the remote machine, using the administrator password, actually logged in, after which the manipulations went with a bang (from the Seven I connected the remote registry of a Windows XP Sp3 machine).

reg save HKLM\SYSTEM\CurrentControlSet\Services "C:\regsave\services.hiv"

If everything goes well, then after running the command the message “Operation completed successfully” will appear, and a proud hive file services.hiv will appear in the regsave directory. In order to return the previous appearance to the changed section, using a previously saved snapshot, you should run the command:

reg restore HKLM\SYSTEM\CurrentControlSet\Services "C:\regsave\services.hiv"

with a high probability that you will receive an “access denied” error, most likely the system is using this branch, and therefore it is busy. But to satisfy the desire for action, let's create a temporary partition:

reg add HKLM\SYSTEM\CurrentControlSet\Services\TEMP

here we added a temporary TEMP section to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services branch. If you enter the command

reg query HKLM\SYSTEM\CurrentControlSet\Services\TEMP

it is clear that it is still empty here. Now let’s run the restore command again, but edit the path where we will overwrite the data:

reg restore HKLM\SYSTEM\CurrentControlSet\Services\TEMP "C:\regsave\services.hiv"

Since the TEMP registry subkey created by the command line is not used by the system (we just created it), the data was successfully written there. Now, by entering the command

reg query HKLM\SYSTEM\CurrentControlSet\Services\TEMP

it can be seen that the contents of the entire service subsection were imported here. As a result of these actions, it is clear that incorrect use of the restore command can lead to simple littering of your registry. Theoretically, to delete the TEMP subsection you need to enter the command:

reg delete HKLM\SYSTEM\CurrentControlSet\Services\TEMP

but in my case it said “access denied”, apparently the system has already taken some of the imported subsections into development, the rest can be easily removed individually.

reg command line utility, export command

There is a second way to make a snapshot of a specific registry via the command line. To do this, the reg export utility is used, its launch allows you to create “patches” - files with the extension .reg, quite often you have encountered them in computer games, but until you run the “patch”, so that information about the game is added to the system, the toy does not will work. The positive side of such files is that you just need to run them so that the information is written down where it needs to be written. Launching the registry from the command line. Well, let's try to export the same Services subsection:

reg export HKLM\SYSTEM\CurrentControlSet\Services "C:\regsave\services.reg"

There are several ways to import registry settings.

Running a REG file

This is the easiest way. It consists of launching a REG file containing the necessary parameters by double-clicking or from the command line.
Note. For more information, see the article REG file

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 1. The system asks for confirmation to make changes.

Command line

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

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 /S parameter

REG ADD command

You can also import registry settings using the REG ADD command. 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.

REG ADD [\\\] The name of the remote computer; if omitted, it is considered equal to the name of the local computer by default. Only the HKLM and HKU partitions are available on remote computers. Full path to the registry key in the form ROOT\Subkey. Root radel. Values ​​[HKLM | HKCU | HKCR | HKU | HKCC]. The full path to the registry key in the selected root partition. /v The name of the parameter to be added in the specified section. /ve Add an empty parameter (Default) to the specified section. /t Data types. By default, it is considered equal to REG_SZ. /s Specifies the separator that is used to separate data in multiline parameters of type REG_MULTI_SZ. By default, it is considered equal to "\0". /d The value assigned to the registry parameter to be added. /f Force overwrite existing registry entries without warning. Examples: REG ADD \\ABC\HKLM\Software\MyCo Adds a section HKLM\Software\MyCo to the remote computer ABC REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead Adds a parameter with name: Data, type: REG_BINARY , and value: fe340ead REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail Adds a parameter with name: MRU, type: REG_MUTLI_SZ, and value: fax\0mail\0\0 REG ADD HKLM\Software\ MyCo /v Path /t REG_EXPAND_SZ /d %%systemroot%% Adds a parameter with name: Path, type: REG_EXPAND_SZ, and value: %systemroot% Note: Use double percent characters (%%) in the line

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 .

These are small files that quietly do their job, allowing the computer to function normally and perform its tasks. If the system files are damaged, then the operating system itself begins to work with errors (“glitchy”).

In the worst case scenario, this could cause Windows to stop working completely. This does not happen often, and there are several reasons why system files become damaged. One of them is the incorrect actions of an inexperienced user who, overestimating his strength, tries to tune the operating system without having either knowledge or experience.

Therefore, I want to warn you right away - if you do not know what you are doing and what consequences this may lead to - DO NOT edit system files or delete them. In principle, this applies to any files with an extension unknown to you.

Let's start looking at system files with the reg file. Because these are the files that users often encounter. Despite this unusual extension, this is actually an ordinary text file. The reg extension tells the operating system that this file contains registry keys and certain settings.

See below what the reg file looks like.

All information is clearly structured for ease of computer processing. So, for example, the mandatory first line REGEDIT with the required parameter tells the computer for which version of the Windows OS the reg file is intended for. Next, in a certain order, are the registry keys and their parameters.

By the way, I have written an article using this file more than once. For example, " "

What is the reg file for?

The main purpose of this type of service files is to work with registry keys. This is the easiest way to create or replace the necessary keys. In an applied sense, the reg file is used to create, store or change user settings. With it, you can quickly and easily transfer settings from one computer to another or create a backup copy so you can restore them in the future.

Working with such files is quite simple. To enter the necessary information into the operating system registry, open the reg file and click “Yes” twice - agreeing to the changes that will be made to the registry. Next, Windows will automatically create the required request, process it and enter the data into its registry.

How to work with reg file

Since, as I mentioned earlier, the reg file is essentially an ordinary text file, programmers have not yet come up with a better tool for working with it than notepad. You can use a standard Windows notepad or its equivalent. Based on my own experience, I can safely recommend using the Notepad+++ program. Firstly, it is free, and secondly, it has a lot of additional features.

Editing itself is no different from working with any text. To save changes, just save the file again using the “File” - “Save As...” command or the hotkey configuration “Ctrl” + “S”.

Creating a file with the reg extension is also done using the standard procedures “File” - “Create” or the hotkey configuration “Ctrl” + “N”. In addition, you can create a reg file using the standard procedure for exporting data from the registry.

In conclusion, I would like to note that working with such files does not cause problems for an experienced user. I would especially like to emphasize “ from an experienced user" If you are just starting to master your computer, I strongly recommend that you do not experiment with the registry. Because, as practice shows, in most cases such experiments lead to the need to restore the operating system. But you will agree that you hardly need this.

In this note we will deal with the question - what are files with the extension reg, what they are for and how they should be used.

Files with the extension reg are service and are used to make changes to .

For example, when data from it is exported to a reg file. At their core, these are ordinary text files, the contents of which can be viewed with any text editor, for example, a standard program Notebook. Theoretically, such a file can be written manually, but this is done extremely rarely.

In order to open the reg file and view its contents, you need to call the context menu by right-clicking on it. Next from the menu you need to select the option “ Change».

The program will open Notebook and in it you will see the contents of the reg file:

But here you need to take into account the following point - if you yourself exported the Windows registry to a reg file, then it can be quite large.

For example, in my case the size of the reg file was 104 MB (I exported the entire registry to a file). Opening such a file can take quite a lot of time, so when creating a registry backup, it is still preferable to export only the registry branch in which you intend to make changes. In this case, the reg file will be created faster when exporting data, and the import of data will be faster when restoring it from a backup copy.

As mentioned above, although reg files are essentially text files, no one works with them in text editors. They are usually used either to make changes to some settings or registry settings, or to create a backup copy of the Windows registry.

To enter data from a reg file into the registry, just run it, that is, double-click the left mouse button on the file. A message will appear warning you that these actions are unsafe:

If you are confident in the file, then you can safely press the button "Yes". All data from the reg file will be imported into the registry. If this file was not created by you, then I recommend that you make a full backup copy of the registry before running it. In this case, you can avoid a lot of problems if something goes wrong.

At some point while working on a PC, each user may need to make changes to the Windows registry. The most trivial example is that the language bar has disappeared and to restore it you need to find and run regedit.exe on the computer. Perhaps for advanced users such an action will not cause any problem, but for beginners such advice will instantly respond with the phrase “it’s easy to say, but how to do it?” Indeed, how to run regedit on a computer? It's actually very simple - just use one of 4 simple methods.

Option number 1: Launch the registry editor through the “Start” system menu

Perhaps this is the most convenient and simplest method that can be used to open regedit on absolutely all computers, regardless of the version of the Windows operating system installed on them. True, depending on the system interface, the actions will differ slightly:

Option #2: Launch regedit using Windows Explorer

You can also get started with the Registry Editor by using the operating system explorer. To do this, open “My Computer”, select Local drive C, and in it the Windows folder. In the contents of the folder we find regedit and launch it by double clicking the mouse.

Option #3: Launch the Windows Registry through the built-in search bar

On a PC running Windows 7, you can launch regedit using the search form built into the top of the folder menu. In this case, just go to the “My Computer” section, enter Local Drive C, enter the name regedit in the address bar and press Enter. The system itself will search and show the access file to the registry editor.

It may be that the system detects several files with regedit in their name. This is not something to be afraid of. We simply find among them the one that is located on the C drive in the Windows folder and is called regedit. To launch it, double-click on it with the mouse, in principle, nothing complicated.

Option number 4: Open the Windows registry through the “Run” command

What's different about this way of launching Registry Editor? The speed of task completion, since to start the program it is enough to perform only 3 steps:

In general, this option for launching the registry is suitable for use on computers with any operating system from Microsoft. However, on computers running Windows XP, you can also take advantage of its internal interface to do this.

In this case, use any of the methods described above to open the “Start” menu, find the “Run” item and click on this tab with the left mouse button. After this, the same standard Windows utility “Run” will open. Now all that remains is to enter the value regedit in the empty search field and click OK. As a result, the registry editor will start and be ready to work - everything is very simple.

Thus, finding and launching the Windows registry (regedit program, registry editor) is quite easy. You just need to choose one option you like from the 4 described above and feel free to start making the system settings you need.