Windows 10 CLI Restore Registry from .reg file with Whole Registry in it.

Paul42

New Member
Joined
Feb 14, 2024
Hi,

I think I've messed my registry up.

Just before doing some registry editing using regedit I saved the whole registry reg.reg.

Rebooted and couldn't get into windows.

Am now booted into Command Prompt but don't know what to do!

I've been playing with reg.exe but not been able to get it to do what I want.

I have no restore points and there are no automatic reg backups.

Can anyone please help? 🙏
 
I understand that you're facing issues after editing your registry and now you're unable to boot into Windows. It's great that you have a backup of the entire registry saved as "reg.reg". We can use this backup to restore your registry.

To restore the registry from the .reg file using the Command Prompt, you can follow these steps:

1. Boot into the Command Prompt. If you're already in the Command Prompt, you can skip this step.

2. Navigate to the location where the "reg.reg" file is saved. You can use the `cd` command followed by the path to the location. For example:
```
cd C:\Path\To\Backup
```

3. Once you're in the correct directory, you can restore the registry by executing the following command:
```
reg import reg.reg
```

4. Wait for the command to complete. It will import the registry from the "reg.reg" file and apply the changes.

5. After the command completes successfully, you can reboot your computer by executing the following command:
```
shutdown /r
```

6. Your computer will restart, and hopefully, the changes will be applied, allowing you to boot into Windows.

Please note that restoring the registry from a backup will revert any changes you made since the backup was created. Make sure to double-check that you have the correct backup file before proceeding.

I hope this helps! Let me know if you have any further questions.
 
Registry settings are stored in "hive" files which are sudo databases. Reg really only works on the currently loaded hives.

There is a bit of a trick you could use but it could be risky.

You can load other hive files (including the real system hives) as keys under HKEY_LOCAL_MACHINE.
You would need to do the following
  1. Open regedit
  2. Select HKEY_LOCAL_MACHINE
  3. Click File > Load Hive
  4. Select the target system hive
  5. Give it a name such as ABCDEDF
  6. You would then need to edit your .reg file to include ABCDEF or whatever you name it between HKEY_LOCAL_MACHINE\ABCDEF\<real key path>
  7. Then in regedit you can import the reg file
 
Registry settings are stored in "hive" files which are sudo databases. Reg really only works on the currently loaded hives.

There is a bit of a trick you could use but it could be risky.

You can load other hive files (including the real system hives) as keys under HKEY_LOCAL_MACHINE.
You would need to do the following
  1. Open regedit
  2. Select HKEY_LOCAL_MACHINE
  3. Click File > Load Hive
  4. Select the target system hive
  5. Give it a name such as ABCDEDF
  6. You would then need to edit your .reg file to include ABCDEF or whatever you name it between HKEY_LOCAL_MACHINE\ABCDEF\<real key path>
  7. Then in regedit you can import the reg file
Update on the problem.

1) When Windows fails to start it says something like unaccessible boot drive - Can reboot if you want me to check.

I assume this is wrong in some way as I'm running SW off it.

2) When I say CLI, I mean the option under the change your startup options. So it looks like I'm running a different recovery windows to mine?

3) What do you mean in 4?
 
You need to load the hive file all of them save for user registry hives are in C:\Windows\System32\Config
 
You need to load the hive file all of them save for user registry hives are in C:\Windows\System32\Config
Sorry still puzzled by 4. In the original config folder there are 10 files, I cannot see a hive file and they don't have any type.

I've loaded a few and they might be hives?

Regedit shows only 5 things under hkeyLM when first started, only 4 of which are in the original config folder, hardware is missing.

I'm confused you keep saying file but I see files?
 
Yeah leave it to Microsoft to be confusing. HKLM is actually a bunch of those no extension files. The main one ones are SYSTEM and SOFTWARE. Hive files don't always have an extension.

Do you have restore points available? You might be able to just load those from the recovery environment to achieve the same thing.
 
Back
Top Bottom