Boot and restore in windows 7.

Using a laptop or desktop PC on the Windows 7 operating system, users often encounter problems loading it, system freezes, or a blue screen. The main causes of these problems may be viruses, deletion of system files and low-quality software. To solve these problems, it is enough to use system restore points.

These restore points are designed to restore the OS to the point in time when it was worked stably. Each restore point is created automatically when there are some changes in the system. For example, when installing a driver or software.

In this material we will pay special attention command line, with which we will restore Windows 7. By restoring the OS through the console, you will significantly speed up the process. Our article will be of particular interest to novice system administrators and advanced PC users.

Running System Restore in the console when the OS boots normally

If in Windows 7 after loading there is unstable operation, programs do not open, system components freeze and do not work, then in this case it is necessary roll back to the previous saved point. Let's launch the console as Administrator. To do this, go to the menu “ Start" and in the search we will type " CMD" Then right-click on the result found and select “ Run as administrator».

After these steps, the console will start in Administrator mode. In the running console window, enter the command rstrui.exe

After executing the command, the System Restore Wizard will open. Click the Next > button in the window that appears to proceed to selecting recovery points.

Let's choose suitable the restore point at which Windows 7 functioned normally and we will continue.

In the window that opens, click the Finish button and confirm the message. After confirming the message, we will start a system rollback to the selected restore point. If the restoration is successful, you will see a corresponding message.

As you can see, launching recovery through the console is not difficult at all.

Restoring via the console in safe mode

The recovery method described below is necessary if Windows 7 cannot be started in the usual way. To go to the Windows alternative boot menu, press the F8 key when the system starts (there may be other options, for example, Del or others). In this menu you need to select the item shown in the image below.

By selecting this item, the operating system will boot no GUI, and the only means through which the system can be controlled will be console. In the console window, enter the already familiar command rstrui.exe

By executing this command we will open the System Restore Wizard. Let's select a suitable access point in the wizard.

From the example it is clear that it is identical to the previous one. The only difference is the launch Windows in safe mode with console support. Typically, this method almost always works, even if the system heavily damaged by viruses, since at startup the OS loads only the main drivers and there is no access to the Internet.

Running System Restore in the console using the Windows 7 installation disc

If the second method does not help restore the system, then the only option to start recovery using the console is installation disk or boot flash drive. Let's turn on our PC and boot from the Windows 7 installation disk.

Now let's move directly to the console itself. To do this, click the hyperlink “ System Restore", which will start searching for installed systems.

Let's select the operating system we need and move on to the next window.

In this window, select the item “ Command line", after which it must start.

In the console, we will type the command rstrui.exe that is already familiar to us. After executing this command, the recovery wizard will start. The work of the master is identical to the examples described above. Therefore, we will skip further description of the recovery wizard.

Recovering the Windows boot record using the console

Using a PC with the Windows 7 operating system, users often encounter problems loading it and receive messages of this type when the OS starts.

Or something like that.

The main culprit for this problem is a corrupted boot record. MBR or broken boot configuration BCD. You can solve this problem using the utility Bootrec.exe. Using the commands " /FixMbr" And " /FixBoot"The utility can create a new boot entry and fix it.

To use these commands, we need to boot from the installation disk and launch the command prompt, as in the previous example. Let's use the first command " /FixMbr» utilities Bootrec.exe.

By running this command we have fixed our boot entry MBR. If this command does not help, then use the second command " /FixBoot» utilities Bootrec.exe.

By running this command we will create a new boot entry that will allow Windows 7 to start.

From the example it is clear that using Bootrec.exe in most cases, you will be able to restore or fix the boot record in Windows 7. I would also like to note that the main reasons that damage or overwrite the boot record are:

  • Changing the local disk size with the operating system using special software;
  • Installing old Windows OS on top of new ones. For example, installing Windows XP on the same PC with Windows 7 installed;
  • Third party recording boot sector, which does not support Windows. For example, linux bootloader GRUB;
  • Various viruses and malware.

By paying attention to the reasons that damage or overwrite the boot record, you can keep your PC in working order.

BCDboot utility

The Windows 7 installation disc contains another great utility that can be used to restore the OS. Let's also boot from the installation disk into the command line. Then enter the command shown below.

In our case, Windows is installed on the “E:\” drive, so we specified the path in the “ E:\windows" By running this command we will restore the configuration files BCD, as well as the bootloader file bootmgr.

By entering the bcdboot.exe command in the console, you can see a description of the utility, as well as a list of additional keys that can be used when starting it.

Console utility MBRFix

This console utility comes bundled with a multiboot disk Hiren's Boot CD.

Hiren's Boot CD this is a disk with dozens of programs that help many computer scientists and system administrators. The main task MBRFix is to restore the Windows boot loader. Disk image Hiren's Boot CD can be downloaded from the official website www.hirensbootcd.org. Booting from Hiren's Boot CD, we will be taken to its boot menu.

In this menu you need to select “ Mini Windows XP" and press Enter. By completing this action, we will download a portable version of Windows XP with the necessary utilities for diagnosing and repairing the system, including our utility MBRFix. Now let's go to " HBCD Menu» from a shortcut on the Desktop. Then in the menu " Programs"let's move on to the points " Partition/Boot/MBR/Commandline/MBRFix».

This will allow us to open the console utility MBRFix. In the console window, enter the command MBRFix.exe /drive 0 fixmbr /win7 /yes

This team will restore the boot record and bootloader, which will allow you to start Windows 7.

Use disk Hiren's Boot CD with utility MBRFix It’s especially convenient if you don’t have the original disk with the seven.

Let's sum it up

In this material, we tried to look at all the ways to restore Windows 7 using the command line. Therefore, after reading this article, you can easily restore the functionality of your computer running Windows 7.

I would also like to note that if the OS system files are severely damaged or erased, then it will not be possible to restore the system or its boot loader. Therefore, if this is exactly the case for you, then make a backup all important information on the hard drive and reinstall Windows.

We hope that our material will help you restore your system or its boot record, and will also allow you to avoid similar problems in the future or quickly solve them.

Video on the topic

Hello dear readers.

Sometimes, as a result of various actions, it may happen that the computer refuses to enter the operating system. And in some cases, this is due to a malfunction of an important tool. The solution is to restore the Windows 7 bootloader.

There are several main signs indicating the need to “return to life” the corresponding element of the operating system:

Bootrec( )

To return your computer to working condition, you need to perform a number of steps. In addition, for the procedure we will need Windows installation files. So we can’t cope with the corresponding data without a disk. We do the following:


This command will show all the possible parameters it works with.

Description of Bootrec keys( )

Teams in the environment cmd.exe can be launched in the standard version, or with special additions. So, for example, if you write “ bootrec.exe /FixMbr", the program writes a boot record to the main partition. Moreover, the latter is compatible with Windows 7 and Vista. This will help restore the functionality of the device. In addition, you can resort to this trick if there is a need to remove non-standard code in the corresponding segment. However, the existing partition table remains the same.

If you use the “” key, the program writes a new boot sector. It is also compatible with the above operating systems from Microsoft. This option is used in several cases:

    The boot file has been replaced with a non-standard one.

    It's damaged.

    After the seventh version or Vista, the previous build was posted. For example, after installing XP, the Windows NT bootloader is used.

Interesting to know! The same effect can be achieved by using the program " bootsect.exe" It is also on disk. To do this, we write “ bootsect /NT60 SYS" A boot sector that is compatible with "" will appear. For detailed information, you need to run the utility with the key " /help».

When writing " bootrec.exe /ScanOs", the application scans all available disks for OS 7 and Vista. As a result, users receive a list of all systems found, even those not registered in the boot data storage.

Using the key " /RebuildBcd"will start scanning all disks for installed operating systems. A list is compiled from which they can be added to the storage. In addition, this command will allow you to rebuild the database. However, before doing this, you definitely need to delete past data.

The above utility has wide functionality. But it will not help if the system startup file is missing. In this case, you need to resort to another tool.

It is worth noting that it works automatically. That is, users only need to get to certain tools, enter a command, and everything will be done independently - there is no need to do anything during the process itself.

BCDboot( )

This tool is designed to create or repair a bootloader located on the main partition. The program also allows you to transfer files between hard drives. Even if the system is not visible on the latter.

To get started, just type “ bcdboot.exe C:\windows" The operation recovers damaged data, including storage files.

The process has several parameters:

    Source – the location of the directory in which the Windows distribution is located. In our case, this is a plastic disk or USB flash drive. This parameter is required. The rest are indicated as necessary.

    « /I» — sets the environment language. If left unchanged, English is used.

    « /s"—indicates the drive letter where the required files will be placed. By default, this is the location that is set by the BIOS or the new system - UEFI.

    « /v"—the detailed work accounting mode starts.

    « /m» - combining the parameters of an existing record and a newly created one. All this is written to a new boot area.

Returning after using Linux( )

It’s worth imagining a situation where you previously had an operating system from Microsoft. And after installing Linux, the first one suddenly stopped starting. This happened as a result of some errors.

If Windows doesn't work for you after installing Ubuntu, don't panic right away. The problem can be solved simply.

dd if=/dev/sda2 of=/linux.boot bs=512 count=1

The code above allows you to copy the boot sector from the " sda2" in linux.boot.

It is worth noting that in this operating system the root element “ / " If this is not the case in your personal situation, first you need to find out which of the existing areas is bootable.

The entry was copied to the user's folder. Therefore, we go to the appropriate directory and transfer the file to the partition where Windows is already installed.

The result will be “ Command line", in which we write only two lines and after each click " Enter»:
Bootrec.exe /FixMbr
Bootrec.exe /FixBoot
After that, we restart the device and see how everything works in our OS.

The Windows 7 bootloader stops working for many reasons - if boot.ini is damaged or you try to install XP along with the “Seven”, after which the latter does not want to boot. This is due to the fact that XP rewrites the Windows 7 MBR boot record. Typically, restoring the Windows 7 boot loader is carried out using standard system tools. You can use another tool, for example, Bootice.

The easiest way to restore the bootloader

If pressing F8 does not open additional startup methods and a troubleshooter, you will need to use a Windows 7 recovery disk or flash drive. From this drive, you will need to boot your computer into the recovery environment by clicking on the system recovery link at the bottom of the OS installation window.

  1. The computer will automatically try to find a solution to the problem, which will notify you in the window that opens.
  2. If the recovery utility copes with the task, all that remains is to reboot.

If it was not possible to restore the Windows 7 bootloader after XP, use the startup recovery tool, which, along with others, is part of the installation disk or flash drive. Usually these simple methods can handle simple MBR startup problems.

Editing boot.ini

Boot.ini is responsible for starting the system by default. If one of the operating systems is installed incorrectly or uninstalled, its non-working entry will be stored in the same boot.ini. It is located at the root of the system partition, so to edit it you need to configure your computer to show hidden files.

Sometimes boot.ini can be corrupted by a virus or some program could have caused it, after which the OS does not start on its own.

The fix is ​​simple - boot from the LiveCD and edit boot.ini using regular notepad. There are only two sections - boot loader, which controls loading, and operating systems. There are several parameters to remember:

  • timeout=10 — time in seconds during which the user can select an OS to start;
  • multi(0) and disk(0) are parameters that must have zero values;
  • rdisk(0) — number of the disk with the system partition (counting from zero).

In general, boot.ini with one OS should look like in the picture.

Using the command line to restore the MBR sector

You can get into command line mode from the same boot disk or flash drive by opening the system recovery tool and selecting the very last item “Command Prompt”.

  1. Enter the command Bootrec and then press Enter, a full list of options will appear
  2. Write down the MBR sector, for which there is the command Bootrec.exe /FixMbr;
  3. After pressing Enter, the computer will notify the user about the successful completion of the operation in the next line;
  4. Next, carry out the procedure for writing a new boot sector by entering Bootrec.exe /FixBoot;
  5. All that remains is to enter Exit and try to restart the computer.
  1. Log in to the command line from the installation disk or flash drive;
  2. Enter Bootrec /ScanOs, after which the utility will scan the computer for the presence of an operating system;
  3. Write the command Bootrec.exe /RebuildBcd in the next line, the program will prompt you to add all found versions of Windows, including XP, etc., to the start menu;
  4. All you have to do is agree with this by pressing Y and Enter in sequence, after which when loading the system you will have a choice of which OS to load - XP or Seven.

You can also fix the problem with the MBR with one more command. To do this, enter bootsect /NT60 SYS at the command line, then Enter. Enter Exit to exit. This will update the main boot code and your systems will appear in the list at boot time.

In case of serious problems, it may not be possible to restore the MBR using the described methods, so it is worth trying to overwrite the files located in the download storage.

BOOTMGR is missing

The computer usually displays this message on a black screen when the MBR sector is damaged or deleted. The reason may not be related to the MBR, for example, if the BIOS settings on the Boot tab have been reset and the system is trying to boot from the wrong disk. But more often than not, it is the bootloader that is to blame, so we will describe how to restore Windows 7 boot.

The Windows 7 disk always has a small 100-megabyte reserved hidden partition for recording OS boot files, including the damaged BOOTMGR. You can simply copy BOOTMGR from the installation media and write it to this partition. For this:

  1. Open a command prompt from your recovery drive.
  2. Enter the diskpart and list volume commands in sequence, after which a list of your disks and the letters that the system has assigned to each of them will appear on the screen. We are interested in the 100 MB reserved partition and the optical drive - drives C and F, respectively, as in the picture.
  3. To exit, type Exit and press Enter.

Enter the installation drive letter followed by a colon and the command to copy the bootmrg bootloader to the reserved partition. It will look like this:

  • F: and then Enter;
  • copy bootmgr C:\ and press Enter;
  • Exit, the utility will exit.

If copying to a hidden partition fails, the boot store can be completely overwritten. Restoring the Windows 7 boot loader is performed with the command bcdboot.exe N:\Windows, where N is the drive letter of the OS. After you are informed that the files were created successfully, you can exit the tool with the Exit command and restart your computer.

  • write down the line diskpart in the command line, which calls the utility;
  • to display all available physical disks, write list disk;
  • select the desired disk with the command sel disk 0, where 0 is the number of the only installed HDD;
  • to display all hard drive partitions, enter list partition;
  • to select a reserved partition, write the command sel part 1, where 1 is the partition number;
  • make it active by typing active;
  • exit the application by typing exit.

As a last resort, you can completely manually delete and format the system partition by starting from some LiveCD, and then use the bcdboot.exe command to create the sector again.

Using Bootice

If Windows XP was installed after "Seven", due to the overwritten MBR sector, only XP starts and you do not have the ability to select a system after you turn on the computer. At the same time, both systems are fully functional, and you can return the startup menu very easily, for which you use the Bootice utility:


In the new Bootice window on the left you will see the OS boot list, to which you will need to add the missing “Seven” to Windows XP:

  • click "Add";
  • in the list that opens, select the line for the new Windows 7 entry;
  • on the right side in the upper input field, select the hard drive;
  • in the field below, indicate the section with “Seven”;
  • click on save basic settings.

The program will notify you that this element has been successfully changed in Boot and you can exit Bootice. The next time you turn on your computer, you can choose which OS to boot from your hard drive - Windows 7 or XP.

Report content


  • Copyright infringement Spam Incorrect content Broken links


Send

For many years, Microsoft has been improving the recovery system for the Windows operating system, and in Windows 7 and Windows Vista it works almost automatically. If you boot from the Windows 7 installation disc and click " System Restore" ("Repair Computer"), the Windows recovery system will launch and will independently try to fix all the errors that it finds. It can fix a large number of problems, however, it is quite likely that the bootloader is damaged, and the recovery system cannot cope with this problem. In this case You can restore the bootloader manually using the Bootrec.exe utility.

The Bootrec.exe application is used to fix errors associated with bootloader corruption and, as a result, the inability to start the Windows 7 and Windows Vista operating systems.

Sequencing

Description of keys for launching the Bootrec.exe utility

Bootrec.exe /FixMbr

Launched with the /FixMbr switch, the utility writes a Windows 7 and Windows Vista-compatible Master Boot Record (MBR) to the system partition. Use this option to resolve problems with the master boot record being corrupted, or if you wish to remove non-standard code from it. In this case, the existing partition table is not overwritten.

Bootrec.exe /FixBoot

Launched with the /FixBoot key, the utility writes a new boot sector compatible with Windows 7 and Windows Vista to the system partition. This option should be used in the following cases:

  1. The Windows Vista or Windows 7 boot sector has been replaced with a non-standard boot sector.
  2. The boot sector is damaged.
  3. A previous version of the Windows operating system was installed after installing Windows Vista or Windows 7. For example, if Windows XP was installed, NTLDR (Windows NT Loader, Windows NT loader) will be used, the code of the standard NT 6 loader (Bootmgr) will be overwritten by the Windows XP installer .

It should be noted that a similar effect can be achieved using the bootsect.exe utility, also located on the Windows 7 bootable media. To do this, you need to run bootsect.exe with the following parameters:

Bootsect /NT60 SYS

The boot sector of the system partition will be overwritten with BOOTMGR compatible code. You can learn more about using the bootsect.exe utility by running it with the parameter /help.

Bootrec.exe /ScanOs

Launched with the /ScanOs key, the utility scans all disks for installed Windows Vista and Windows 7 operating systems. In addition, when used, it displays a list of found systems that are not currently registered in the Windows boot configuration data store (Boot Configuration Data (BCD) )Store).

Bootrec.exe /RebuildBcd

Launched with this key, the utility scans all disks for the presence of installed Windows Vista or Windows 7 operating systems. Found operating systems are displayed in a list from which they can be added to the Windows boot configuration data store (Boot Configuration Data Store). Also use this option if you want to completely rebuild the boot configuration data store. Before doing this, you must delete the previous storage. The set of commands could be as follows:

Bcdedit /export C:\BCDcfg.bak attrib -s -h -r c:\boot\bcd del c:\boot\bcd bootrec /RebuildBcd

The example above exports the current boot configuration store to C:\BCDcfg.bak, removes its system, hidden, and read-only attributes, removes it with DEL, and rebuilds it with bootrec /RebuildBcd.


Enlarge picture

Of course the utility Bootrec.exe is very functional, however, it will not help if, for example, the Windows boot loader file bootmgr damaged or physically missing. In this case, you can use another utility, also included in the Windows 7 distribution media - bcdboot.exe.

Recovering the boot environment using BCDboot.exe

BCDboot.exe is a tool that is used to create or restore a boot environment located on the active system partition. The utility can also be used to transfer download files.

The command line in this case might look like this:

Bcdboot.exe e:\windows

Replace e:\windows with the path that matches your system.
This operation will repair the corrupted Windows boot environment, including the boot configuration data (BCD) store files, including the bootmgr file mentioned above.

Syntax of bcdboot command line parameters

The bcdboot.exe utility uses the following command line parameters:

BCDBOOT source]

source

Specifies the location of the Windows directory used as the source when copying boot environment files.

Optional parameter. Sets the boot environment language. The default is English (US).

Optional parameter. Specifies the drive letter of the system partition where the boot environment files will be installed. By default, the system partition specified by the BIOS firmware is used.

Optional parameter. Enables detailed logging mode of the utility operation.

Optional parameter. Combines the parameters of the newly created and existing boot storage record and writes them to the new boot record. If an operating system boot loader GUID is specified, combines the boot loader object with the system template to create a boot entry.

Summary

The article discussed the principles of working with the bootrec.exe and bcdboot.exe utilities, which are used to resolve problems associated with the inability to start the Windows 7 operating system due to a damaged or missing bootloader.

Starting a computer involves checking the BIOS of all equipment, and if the self-test is successful, loading Windows. The system boots thanks to the bootloader, in which special data is recorded for this purpose. This data can be damaged at any time and a type error and others may appear. If you see a similar error on the screen, or something similar, but the fact is that Windows does not boot, you need to Windows 7 Boot Loader Recovery. By the way, I wrote about boot record recovery for other systems in the following articles:

Now let's get down to business.

Recovering the Windows 7 bootloader using a recovery disc

You need to get a disk with Windows 7, if you have one, great, but if not, then make a bootable USB flash drive. The version in this case is not important, the bit depth is also not important. Boot from a flash drive. When you see the Windows installer at the bottom left, click "System Restore".

A small window will appear with system recovery options. Select the system that needs to be restored. Click the “Next” button.

And here is a window with the necessary options. First, you can try automatic troubleshooting, this is the very first item called "Startup Recovery". Once you click it, you just wait. The disadvantage of this method is that it does not always work, so we will use manual methods.

Using the Command Line

In recovery options, open Command Prompt. There we will enter the following command:

bootrec/fixmbr

Using this simple command, you can restore the boot record on Windows 7. If this does not help, move on to the next step:

bootrec/fixboot

Both commands are more likely to restore the Windows 7 bootloader. Close the command prompt, restart the computer and see what happens. In fact, the system should boot without problems. If this is not the case, I have prepared some more methods.

Use the command line #Method 2

We enter the following commands again and one additional one:

  • bootrec/fixmbr
  • bootrec/fixboot
  • bootsect /nt60 ALL /force /mbr

Let's try to boot the system.

Editing the boot.ini file

A special boot.ini file is responsible for loading the system. Today we will torture him. Perhaps its integrity was compromised as a result of a virus attack or a simple PC failure, so restoring the bootloader of Windows 7 or another system is a priority.

We will need a bootable USB flash drive with 7 again. Once downloaded, click the “Install” button. Go to the window where you can select a disk to install the system. Press Shift+F10 to launch Command Prompt.

At the command prompt, enter:

notepad

We will open Notepad, where we need to click “File” and “Open”. In the system disk, turn on showing system files, otherwise you will not see boot.ini.

Edit this file using notepad. There are the following options:

  • timeout=10– time to select the operating system boot (if there are several of them);
  • multi(0) And