What happens when I delete the entire Windows registry?

25

3

I've been wondering what would happen if I delete all the registry stuff. Would my PC stop working? Edit: I've edited the code, now it should delete the registry.

cd %TMP%
reg query HKCR> RegTest.txt
reg query HKCU>> RegTest.txt
reg query HKLM>> RegTest.txt
reg query HKU>> RegTest.txt
reg query HKCC>> RegTest.txt
@pause && cls
for /f "delims=" %%I in (RegTest.txt) do reg delete "%%I" /va /f

SkYWAGz

Posted 2014-10-25T19:09:00.250

Reputation: 329

Well, nothing happened. Command completed successfully though. So nothing changed, lol :-) Edit: Ofc. i rebooted it. – Haplo – 2014-10-25T19:33:30.933

open regedit post a screen grab... then reboot it ..... – Logman – 2014-10-25T19:34:00.707

Before Reboot It's in Turkish but it says command completed. And after reboot. – Haplo – 2014-10-25T19:41:40.447

How mutch time did it take to delete it? and what changes after reboot? when u opened regedit after rebood was it still empty? – SkYWAGz – 2014-10-25T19:44:46.750

Like i said nothing changed. Registry keys was not deleted and command completed immediately. So, like i said you can't do something like this. – Haplo – 2014-10-25T19:47:34.593

Can you try it but this time run the batch file as administrator? Cuz i tried it on my pc and it said "Command completed successfully" without deleting anything. – SkYWAGz – 2014-10-25T19:58:11.517

As you can see in first image, i already ran it as administrator – Haplo – 2014-10-25T20:09:12.130

On my machine, I get "Invalid key name." error for every line of the batch file. – Little Helper – 2014-10-25T20:09:48.850

@LittleHelper cause you should remove \ at the end of line. – Haplo – 2014-10-25T20:10:56.220

@Haplo Try deleting files directly from regedit – SkYWAGz – 2014-10-25T20:13:02.553

OKay, now it shows "The operation completed successfully." like for every one else. – Little Helper – 2014-10-25T20:13:11.550

@SkYWAGz It's greyed out.

– Haplo – 2014-10-25T20:15:42.223

This isn't a discussion forum. Please grab yourselves a chat room in our [chat], or post an answer showing the results if they're any different. Thanks. – slhck – 2014-10-26T09:14:49.187

Answers

36

You can’t delete the root nodes. They don’t physically exist. You can, however, delete their contents, via Regedit (as opposed to reg).

Regedit hangs as soon as I try to delete HKLM\SYSTEM. After resetting the VM (because I’m lazy), I get the following screen (OS is Windows XP):

enter image description here

(“Windows could not start because the following file is missing or corrupt: \WINXP\system32\config\SYSTEM”)

So yes, deleting stuff from the registry will absolutely positively kill Windows. And unless you have a backup, restoring it is impossible.

Daniel B

Posted 2014-10-25T19:09:00.250

Reputation: 40 502

thanks for testing/demonstration and I don't think you could have been clearer with the outcome of deleting the registry "absolutely positively kill Windows"! Out of curiosity what VM software are you using? – benscabbia – 2014-10-25T21:50:55.660

I don't use or care about Windows, but should'nt it read "deleting stuff from the registry can absolutely positively kill Windows" to be strictly correct? – Volker Siegel – 2014-10-26T00:38:48.550

"start repair" doesn't know nearly enough to put everything back again the way it was. – Jamie Hanrahan – 2014-10-26T01:43:36.643

@JamieHanrahan Depends; there's some level of registry backups as part of System Restore (which Startup Repair will run). I can't remember if they were full hives or just some keys, though. – Bob – 2014-10-26T03:28:21.633

@gudthing I use VMware Workstation. – Daniel B – 2014-10-26T09:14:33.623

6"impossible" as in theoretically or practically? – Bleeding Fingers – 2014-10-26T09:25:34.157

2@BleedingFingers Are you referring to undoing the damage? Because the registry is never the same for two Windows installation that are actually in use, you cannot use anything but a very recent backup to fully restore the PC. Granted, with less critical stuff like file associations, using another installation’s data might work. – Daniel B – 2014-10-26T09:30:32.330

2Without a backup, you'd need to try and use another machine's registry files, because the registry is used to locate drivers very early in the boot process (e.g. things like disk drivers), and without some very basic drivers, the kernel doesn't know how to interact with the hardware. – Barry Kelly – 2014-10-26T19:00:14.490

3Usually, Windows makes numerous backups of the registry automatically, most via restore points. In Windows XP, you could look at these registry snapshots in C:\System Volume Information and then copy them over to C:\Windows\config. I did this once with an old laptop successfully. – oldmud0 – 2014-10-26T21:47:30.723

9

Windows stores a lot of critical information in the registry, which is loaded (at least a part of it) during an early stage while booting. If you remove this information Windows will be unable to find and load critical system files and thus be unable to boot.

Such critical information is e.g. the list of device drivers needed for booting the system. This may include:

  • disk drivers (floppies, hard disks, CDs, USB-devices, ...)
  • bus drivers (IDE, SATA AHCI, ...)
  • file system drivers (FAT, NTFS, ...)
  • ...

However, by default Windows stores a backup copy of the registry. If you've enabled "System Restore" you can find such copies in the (hidden) System Volume Information Folder inside the root folder of the system partition. Additionally, even if you do not have "System Restore" enabled, Windows saves a backup copy of the registry in %WINDIR%\System32\config\RegBack\.

You can manually copy the backup files into %WINDIR%\System32\config\ to restore the registry data.

StW

Posted 2014-10-25T19:09:00.250

Reputation: 151