All You Need to Know About Windows Registry, Creating Keys and Values所有您需要了解的关于 Windows 注册表、创建密钥和值的信息
所有您需要了解的关于 Windows 注册表、创建密钥和值的信息
Windows 注册表是 Windows 操作系统的神秘部分之一,它允许我们调整和修改 Windows 的几乎所有部分。尽管我们一直使用注册表,但大多数人对注册表的真值只有一点点了解,并且不确定如何创建自定义键和值。因此,让我们找出一两个有关 Windows 注册表及其组件的事情。
什么是 Windows 注册表
Windows 注册表只不过是与操作系统、程序和用户相关的不同配置和设置的集合。你可以把它像一个数据库,几乎存储所有重要信息。此信息包括与系统硬件、应用程序设置、已安装的程序、用户配置文件等相关的任何内容。由于所有重要信息都存储在一个位置,Windows 总是引用注册表,而且 Windows 实际上更容易、更快地管理操作系统的不同部分,而不会弄乱位于不同位置的大量单个配置文件。
Windows 注册表的组件
Windows 注册表由三个主要组件组成 - 根级密钥、键和值。"根级密钥"承载所有"密钥","密钥"将有自己的一组"值"。你可以把它想像"本地驱动器 ->文件夹 ->文件"在您的系统中。
注册表中有五个不同的根级密钥,它们有自己的特定用途。下面是这些根键的要点。
HKEY_CLASSES_ROOT(香港时间):此根密钥由 Windows 用于管理对象链接和嵌入 (OLE) 和文件类型关联。这是 Windows 将所有文件链接到其相关程序的关键,以便您可以打开这些文件并与它们进行交互。
HKEY_CURRENT_USER(香港大学):Windows 注册表的这一部分承载与当前登录的用户关联的所有数据、用户级设置和配置。不仅 Windows 操作系统,其他程序还存储与当前用户相关的数据。
HKEY_LOCAL_MACHINE(香港无论用户状态如何,本节都包含所有与系统相关的密钥,包括任何硬件设置、软件设置等。由于此密钥承载了系统范围大部分信息,因此 HKLM 是 Windows 注册表中访问最多的根密钥之一。
HKEY_USERS(香港大学):从名称中可以看到,此根密钥承载所有用户的所有设置,包括系统中任何登录和注销的用户。由于您可以找到有关其他用户的设置,请不要将此根键与 HKCU 混淆。
HKEY_CURRENT_CONFIG(香港协进会):简单地说,你可以称之为伪根键,因为它只是直接链接到 HKLM 根键中的当前硬件配置文件设置。
关键值
上述每个根键都有自己的密钥,每个密钥都有自己的值。对于每个键,您可以创建六个不同的值,这些值完全取决于目标程序/或配置要求。
字符串值:字符串值大多是人类可读的,并且只有一行文本信息,如文件路径。字符串值是 Windows 注册表中最常用的值之一。
二元值:如名称所示,这些值仅包含二进制数据 (0, 1)。这些值通常用于打开或关闭特定设置。
DWORD 值(32 位):DWORD 值与二进制值类似,但也能够存储 32 位范围内的任何整数。DWORD 值设计用于 32 位系统,但也用于 64 位系统,实现向后兼容性。
QWORD 值(64 位):QWORD 值与 DWORD 值一样,但能够将任何整数保持到 64 位范围内。您可以说这些设计用于 64 位系统。
多字符串值:如果 String 值用于存储单行字符串,则多字符串值用于存储多行字符串或文本信息。
可扩展字符串值:可展开字符串值与普通字符串值类似,但包含环境变量。
创建新密钥和值
在 Windows 注册表中创建密钥和值相对简单明了。但在执行任何操作之前,请备份 Windows 注册表,因为任何错误配置或不需要的删除可能会导致严重错误。
要创建新的密钥,请右键单击 Root 级别键,然后选择"新"选项,然后选择"键"。默认情况下,新创建的密钥将看起来像一个文件夹,并将命名为类似"新密钥 #"。您始终可以根据需要修改密钥名称。每当要创建新的子密钥时,都会应用相同的过程。
要创建新值,请在右窗格中右键单击,然后根据您的需要选择该值,如上所述。创建值后,您需要命名它;名称完全取决于特定要求。但请注意,如果在右窗格中选择"键"选项,Windows 注册表将自动创建新的子密钥。
创建和重命名新值后,需要输入值数据。为此,双击该值并输入"值数据"。同样,值数据取决于程序或特定设置。
这就是所有需要做的,希望这有助于您更好地了解 Windows 注册表及其组件,并创建新的键和值。
Windows Registry is one of the mysterious parts of the Windows operating system that allows us to tweak and modify almost all the sections of Windows. Even though we work with the registry all the time, most people have only a little understanding of what it really is and are not sure of how to create custom keys and values. So let’s find out a thing or two about Windows Registry and its components.
What is Windows Registry
Windows Registry is nothing but a collection of different configurations and settings related to the operating system, programs, and users. You can think of it like a database that virtually stores all the important information. This information includes anything related to system hardware, application settings, installed programs, user profiles, etc. Since all the important information is stored in a single place, Windows refers to the Registry all the time, and it is actually easier and faster for Windows to manage different parts of the operating system without messing with tons of individual configuration files located in different locations.
Components of Windows Registry
Windows Registry consists of three main components – the Root level keys, Keys, and Values. “Root-level keys” hosts all the “Keys” and the “Keys” will have their own set of “Values.” You can think of it like “LocalDrive -> Folder -> File” in your system.
There are five different Root level keys which have their own specific purpose in the registry. Here is a gist of these root keys.
HKEY_CLASSES_ROOT (HKCR): This Root key is used by Windows to manage Object Linking and Embedding (OLE) and file type associations. This is the key where Windows links all your files to their relevant programs so that you can open and interact with them.
HKEY_CURRENT_USER(HKCU): This section of Windows Registry hosts all the data, user-level settings and configurations associated with the currently logged in user. Not only the Windows operating system, but other programs also store data relevant to the current user.
HKEY_LOCAL_MACHINE (HKLM): Regardless of the user status, this section contains all the system related keys including any hardware settings, software settings, etc. Since this key hosts most of the system-wide information, HKLM is one of the most accessed root keys of Windows Registry.
HKEY_USERS (HKU): As you can see from the name, this root key hosts all the settings of all the users including any logged in and logged off users on the system. As you can find settings regarding other users, don’t confuse this root key with HKCU.
HKEY_CURRENT_CONFIG (HKCC): Simply put, you can call this a pseudo root key as it is just a direct link to the Current Hardware Profile Settings in the HKLM root key.
Key values
Each of the above Root Keys has their own Keys, and each Key has its own values. For each Key, you can create six different values, and those values depend entirely upon the target program and/or the configuration requirements.
String Value: String Values are mostly human readable and only have a single line of textual information, like file paths. String Values are one of the most commonly used values in the Windows Registry.
Binary Value: As the name implies, these values only contain binary data (0, 1). Often these values are used to turn on or off a particular setting.
DWORD Value (32-bit): DWORD values are similar to Binary values but are also capable of storing any integer in the range of 32-bit. DWORD values are designed to work with 32-bit systems, but are also used in 64-bit systems for backward compatibility.
QWORD Value (64-bit): QWORD values are just like DWORD values but are capable of holding any integer within the range of 64-bits. You can say these are designed to work with 64-bit systems.
Multi-String Value: If String values are used to store single line strings, Multi-String values are used to store multi-line strings or textual information.
Expandable String Value: Expandable String values are similar to normal String values but contain the environmental variables.
Creating New Keys and Values
Creating Keys and Values in Windows Registry is relatively easy and straightforward. But before doing anything, please back up your Windows Registry as any misconfigurations or unwanted deletions may cause critical errors.
To create a new Key, right-click on the Root level key and select the option “New” and then “Key.” By default, the newly created key will look like a folder and will be named something like “New Key #.” You can always modify the key name as required. The same procedure is applied whenever you want to create a new Sub-Key.
To create a new value, right-click in the right pane and select the value depending on your needs as discussed above. Once the value is created, you need to name it; the name depends entirely upon the specific requirement. But do note that if you select the option “Key” in the right-pane, Windows Registry will automatically create a new Sub-Key.
Once the new value is created and renamed, you need to enter the value data. To do that, double-click on the value and enter the “Value Data” as required. Again, the Value Data depends on the program or the specific settings.
That’s all there is to do, and hopefully this helps you to understand the Windows Registry and its components better and to create new keys and values as required.
Do comment below sharing your thoughts and experiences.