注册表(Registry)是Microsoft Windows操作系统、其应用程序和硬件设备驱动程序用于维护其配置的所有设置的数据库。
在许多方面,注册表(Registry)位于Windows的核心,高级用户可以使用它来让他们的计算机完成原本不可能的事情。
警告:对(Warning: )注册表(Registry)进行更改可能会损坏您的计算机。您应该只进行您觉得舒服的更改,并且您应该始终事先备份注册表。(back up the Registry)
登记处的(简要)历史
为什么 Windows 有注册表?注册表随着Windows 95(Windows 95)的发布而被引入 Windows,并持续到Windows 11。在Windows 95之前,配置信息存储在文本文件中,类似于当前的 .ini 文件。
这有几个问题。首先(First),人们很容易意外删除这些文本文件,无法挽回损失。其次,这些配置文件没有标准的结构。不同的开发人员为他们的应用程序制作了它们。
Registry集中化和标准化的配置存储。它还使用户几乎不可能意外删除或破坏注册表(Registry)中的任何信息。它可以备份(我们将在下面介绍)并且受到Windows的严密保护,免受恶意攻击。
在当今的Windows 10和Windows 11操作系统中,注册表(Registry)是一个可以自我维护和修复的复杂系统,但它并非万无一失。
基本注册表结构
注册表(Registry)是一个分层数据库。层次结构的顶部是您的计算机。在此之下,您会发现被称为“荨麻疹”的主要分支。在这些配置单元中是注册表(Registry)项。键可以包含子键和注册表(Registry)值。
存在三种类型的键值:String、Binary或DWORD。字符串是一行文本。二进制值就像听起来一样 - 表示为 1 和 0 的值。DWORD是一个四字节的数字。这些通常用于存储布尔值,因此 1 或 0 可以表示“启用”和“禁用”。
五个主要分支分别存储不同类别的设置:
- HKEY_CLASSES_ROOT:也称为“ HKCR ”,这是Windows界面设置(如文件关联、快捷方式和支持拖放功能的设置)的位置。
- HKEY_CURRENT_USER:也称为“ HKCU ”,这里是当前登录的Windows用户的设置,例如登录名和自定义桌面和开始菜单(Start Menu)设置。
- HKEY_LOCAL_MACHINE:也称为“ HKLM ”,这是存储硬件和软件设置的位置,包括组策略(Group Policy)设置。
- HKEY_USERS:包含 PC 的所有用户的设置。每个用户都有一个子密钥。
- HKEY_CURRENT_CONFIG:这链接回与当前硬件配置设置相关的HKEY_LOCAL_MACHINE部分。(HKEY_LOCAL_MACHINE)
如果您正在寻找计算机特定方面的注册表(Registry)设置,了解这些主要分支之间的差异可以减少您在找到所需内容之前必须进行调查的时间。
使用 Regedit 进行注册表编辑
虽然注册表(Registry)旨在抵御蓄意和意外篡改,但Windows包含一个可让您浏览和编辑注册表(Registry)的应用程序。该应用程序称为Windows 注册表编辑器(Windows Registry Editor)(或简称为Regedit),它向您显示注册表(Registry)的结构及其包含的所有值。
打开键并更改值就像展开注册表(Registry)树一样简单,直到找到要查找的值,然后双击要更改的值。
要打开注册表编辑器(Registry Editor),请按Windows 键(Windows key)+ R打开运行对话框。键入regedit或regedit.exe并按Enter。或者,使用“开始”菜单(Start Menu)搜索它,然后在出现结果时单击“注册表编辑器”。(Registry Editor)
你应该编辑注册表吗?
除非您有特定的理由,否则您不应编辑注册表。(Registry)这个原因必须比系统的稳定性以及您可能丢失的任何时间和数据更重要。
如果您遵循在线指南,该指南向您展示如何编辑注册表(Registry)以获得特定结果,请查看评论以了解该编辑如何为人们工作。此外,根据您在此处了解的注册表(Registry)结构,尝试查看指南显示的内容是否有意义。如果编辑出现问题,您的计算机可能会在关闭后启动失败,因为您损坏了系统设置。
因此,在进行更改之前,您应该始终备份注册表。
备份您的注册表
您可以通过多种方式备份和恢复注册表(Registry)。
如果您使用Windows备份工具或第三方备份实用程序(出于各种原因这是一个好主意)进行完整驱动器备份,则注册表(Registry)会与其他所有内容一起备份。缺点是如果您需要恢复该备份,您将丢失自上次备份以来创建的任何其他数据。
当您使用系统还原(System Restore)实用程序创建还原点时,您还会在该时间点对注册表(Registry)进行备份。从还原点还原时,不会丢失自上次创建还原点以来创建的文件等数据。
您可以使用注册表编辑器(Registry Editor)单独创建注册表的备份。(Registry)只需(Simply)选择文件(File)>导出(Export)并选择保存位置。
然后,您可以将该注册表(Registry)文件存储在云中或物理备份媒体上。在更改注册表之前导出注册表(Registry)也是一个好主意,因为如果您以任何方式将其弄乱,您可以使用File > Import立即导入保存的(Import)REG文件。您还可以通过右键单击配置单元并选择“导出(Export)”来导出特定配置单元。
注意:(Note: )我们不建议恢复超过一天的注册表(Registry)备份,因为您的计算机上可能发生了太多更改,这可能导致注册表(Registry)比您要替换的注册表更不合适。
查看我们备份注册表的深入指南,(in-depth guide to backing up the Registry)以确保您永远不会留下无法恢复的注册表。(Registry)
注册表出了什么问题
您的Registry(Registry)可能会出现一些问题。根据它是如何发生的以及它对您的计算机产生的影响,如果您没有要恢复的最近的注册表(Registry)备份,您可能能够修复该问题,或者它可能会证明“问题”不是问题。
孤立的注册表项(Orphaned Registry Entries)
孤立条目是卸载软件时留下的键和值。它们是由马虎的卸载软件造成的。这些是无害的,但注册表(Registry)清理应用程序是在孤立条目“堵塞”您的注册表(Registry)并影响性能和稳定性的前提下出售的。我们建议避免使用注册表(Registry)清洁器,这弊大于利。
重复键(Duplicate Keys)
重新安装、升级或更新您的软件可能会导致重复密钥。这些同样是无害的,所以不要担心或相信注册表(Registry)清理人员在这个问题上所说的话。
注册表“碎片化”(Registry “Fragmentation”)
这是指删除键或值时注册表配置单元中留下的空白。(Registry)这是另一个无影响的注册表“(Registry “)错误”,无需修复、整理或压缩注册表(Registry),尤其是在Windows 10或 11 中。
注册表损坏(Registry Corruption)
数据(Data)损坏可能会影响计算机驱动器的任何部分。如果它使您的注册表(Registry)文件完全或部分不可读,您的计算机可能会拒绝启动或表现出奇怪的行为。在恢复注册表(Registry)之前,您需要确定损坏的原因,尤其是在硬件数据损坏的情况下。
破坏性编辑(Destructive Editing)
当有人使用注册表编辑器(Registry Editor)意外破坏内容但以使Windows或应用程序无法使用的方式删除或修改值时,就会发生这种情况。恢复最近的注册表(Registry)备份是主要解决方案。
恶意软件(Malware)
恶意软件(Malware)可以修改您的注册表(Registry),以赋予自己不应拥有的权限或数据访问权限。这种类型的注册表(Registry)损坏很难检测到,因为恶意软件作者试图保持未被检测到。即使在恶意软件被删除后,注册表(Registry)损坏可能仍然存在。
注册表(Registry)损坏可能会很痛苦,因此请查看如何修复损坏的注册表项(How to Fix Broken Registry Items)和如何修复注册表错误(How to Fix Registry Errors),其中还包括命令提示符(Command Prompt)修复,如果事情严重损坏以至于您无法启动到Windows图形用户界面。
如果您破解注册表会发生什么
在这一点上,您可能对弄乱您的注册表有点警惕。如果这是真的,那么我们已经完成了我们的工作。编辑您的注册表不是一件容易的事。
但是,如果您小心并使用良好的资源,您可以显着改善您的Windows体验并以任何实用程序或应用程序无法实现的方式自定义Windows。
例如,您可以:
- 更改桌面上下文菜单
- 修改桌面图标间距
- 禁用用户帐户控制(User Account Control)( UAC ),但除非你真的必须这样做,否则不要这样做
这些只是几个示例,但如果您前往10 个您可能不知道的令人敬畏的 Windows 10 注册表黑客(10 Awesome Windows 10 Registry Hacks You Might Not Know),您将学习如何完成这些简单而有效的黑客攻击。
What Is the Windows Registry (and What Can You Do With It)?
The Registry is a databasе of all the settingѕ that the Microsoft Wіndows operating system, its applications, and hardware device drivers use to maintаin their cоnfigurations.
In many ways, the Registry sits at the heart of Windows, and power users can use it to make their computers do things that would otherwise be impossible.
Warning: Making changes to the Registry can break your computer. You should only make changes you are comfortable with, and you should always back up the Registry beforehand.
A (Brief) History of the Registry
Why does Windows have a registry? The Registry was introduced to Windows with the release of Windows 95 and persisted to Windows 11. Before that Windows 95, configuration information was stored in text files, similar to current .ini files.
There were several problems with this. First, it was easy for people to accidentally delete these text files, with no way to undo the damage. Second, these configuration files didn’t have a standard structure. Different developers made them up for their applications.
The Registry centralized and standardized configuration storage. It also made it virtually impossible for users to accidentally delete or destroy any of the information in the Registry. It can be backed up (which we’ll cover below) and is tightly protected by Windows from malicious attacks.
In today’s Windows 10 and Windows 11 operating systems, the Registry is a sophisticated system that can maintain and repair itself, but it’s not infallible.
The Basic Registry Structure
The Registry is a hierarchical database. At the top of the hierarchy is your computer. Under that, you’ll find the main branches, known as “hives.” Within these hives are Registry keys. Keys can contain sub-keys and Registry values.
There are three types of key values: String, Binary, or DWORD. A string is a line of text. A binary value is just as it sounds—a value expressed as ones and zeroes. A DWORD is a four-byte number. These are usually used to store boolean values, so a 1 or a 0 could represent “enabled” and “disabled.”
The five main branches each store a different class of settings:
- HKEY_CLASSES_ROOT: Also known as “HKCR,” this is where Windows interface settings such as file associations, shortcuts, and settings that support drag-and-drop functionality.
- HKEY_CURRENT_USER: Also known as “HKCU,” here are settings for the currently logged-in Windows user, such as login names and custom desktop and Start Menu settings.
- HKEY_LOCAL_MACHINE: Also known as “HKLM,” this is where settings for hardware and software are stored, including Group Policy settings.
- HKEY_USERS: Contains settings for all users of the PC. Each user has a sub-key.
- HKEY_CURRENT_CONFIG: This links back to the portion of HKEY_LOCAL_MACHINE related to current hardware configuration settings.
If you’re looking for the Registry settings of a specific aspect of your computer, knowing the difference between these main branches can cut down how long you have to investigate before finding what you need.
Registry Editing With Regedit
While the Registry is designed to withstand deliberate and accidental tampering, Windows has an included app that lets you explore and edit the Registry. Known as the Windows Registry Editor (or simply Regedit), the app shows you the structure of the Registry and all of the values it contains.
Opening a key and changing a value is as easy as expanding the Registry tree until you find the value you’re looking for and then double-clicking the value you want to change.
To open the Registry Editor, press the Windows key + R to open the run dialog box. Type regedit or regedit.exe and press Enter. Alternatively, search for it using the Start Menu and click on Registry Editor when the result appears.
Should You Edit the Registry?
You should not edit the Registry unless you have a specific reason to do it. That reason has to be more important than the stability of your system and any time and data you might potentially lose.
If you follow an online guide that shows you how to edit your Registry for a specific outcome, check the comments to see how that edit worked for people. Also, based on what you’ve learned about the Registry structure here, try to see if what the guide shows makes sense. If something goes wrong with the edit, your computer may fail at startup after a shut down because you’ve corrupted your system settings.
For that reason, you should always back up the Registry before making changes.
Backing Up Your Registry
You can back up and restore the Registry in several ways.
If you do a full drive backup using the Windows backup tool or a third-party backup utility (a good idea for all sorts of reasons), the Registry is backed up along with everything else. The drawback is that if you need to restore that backup, you’ll lose any other data created since your last backup.
When you use the System Restore utility to create a restore point, you also make a backup of the Registry at that point in time. When you restore from a restore point, you don’t lose data such as files you’ve created since the last restore point was created.
You can use the Registry Editor to create a backup of the Registry alone. Simply select File > Export and choose a save location.
You can then store that Registry file in the cloud or on physical backup media. It’s also a good idea to export the Registry right before you make changes to it because if you mess it up in any way, you can immediately import the saved REG file using File > Import. You can also export specific hives by right-clicking the hive and selecting “Export.”
Note: We don’t recommend restoring a Registry backup that’s more than a day old since too many things may have changed on your computer, which can lead to a Registry that’s even more unsuitable than the one you’re replacing.
Check out our in-depth guide to backing up the Registry to ensure you’re never left with a Registry you can’t restore.
How Things Go Wrong With the Registry
Several things can go wrong with your Registry. Depending on how it happened and what effects it’s had on your computer, you may be able to repair the problem in case you have no recent Registry backup to restore, or it may turn out that the “issue” is a non-issue.
Orphaned Registry Entries
Orphaned entries are keys and values left behind when you uninstall software. They result from sloppy uninstallation software. These are harmless, but Registry clean-up apps are sold on the premise that orphaned entries “clog up” your Registry and affect performance and stability. We recommend avoiding Registry cleaners, which can do far more harm than good.
Duplicate Keys
Reinstallations, upgrades, or updates to your software can cause duplicate keys. These are likewise harmless, so don’t worry about it or believe what Registry cleaners have to say on the subject.
Registry “Fragmentation”
This refers to gaps left in Registry hives when keys or values are deleted. This is another Registry “error” that affects nothing, and there’s no need to repair, defragment, or compact your Registry, especially in Windows 10 or 11.
Registry Corruption
Data corruption can hit any part of a computer’s drive. If it renders your Registry files wholly or partly unreadable, your computer will likely refuse to boot or exhibit strange behavior. You need to nail down the cause of the corruption before restoring the Registry, especially in the case of hardware data corruption.
Destructive Editing
This happens when someone uses the Registry Editor to break things accidentally but deletes or modifies values in a way that makes Windows or applications unusable. A restore of a recent Registry backup is the primary solution.
Malware
Malware can modify your Registry to give itself permissions or data access it shouldn’t have. This type of Registry damage is hard to detect since the malware authors are trying to remain undetected. Even after malware is removed, Registry damage may remain.
Registry damage can be a pain, so check out How to Fix Broken Registry Items and How to Fix Registry Errors which also cover Command Prompt fixes if things are so broken that you can’t boot into the Windows graphical user interface.
What’s Possible if You Hack Your Registry
At this point, you may be more than a little wary of messing with your Registry. If that’s true, then we’ve done our job. Editing your Registry is not something to be taken lightly.
However, if you’re careful and use good sources, you can significantly improve your Windows experience and customize Windows in ways that no utility or app can.
For example, you can:
- Change the Desktop context menu
- Modify Desktop icon spacing
- Disable User Account Control (UAC), but don’t do this unless you really have to
These are only a few examples, but if you head over to 10 Awesome Windows 10 Registry Hacks You Might Not Know, you’ll learn how to pull off these simple yet effective hacks.