Difference Between HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE

HKEY_CURRENT_USER vs HKEY_LOCAL_MACHINE

HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE are two root keys in Windows registry that is a vital part of every Windows OS installation since Windows 3.1. The Windows registry holds device settings, software options, and other information regarding the computer, the OS, and applications that are on it. The main difference between HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE is what they pertain to. HKEY_LOCAL_MACHINE holds information that is relevant to the computer as a whole while HKEY_CURRENT_USER contains information that is specific to the user. Therefore, there is only one copy of HKEY_LOCAL_MACHINE while there are multiple copies of HKEY_CURRENT_USER with different values.

If a user decides to edit the registry entries in HKEY_CURRENT_USER, he will only be changing the settings for himself. But if he changes the entries in HKEY_LOCAL_MACHINE, he would be changing the settings for everyone using that computer. A good example of this would be installing a new software. Many software ask upon installation whether it would be for the current user only or for everybody. Selecting for the current user only would result in entries being made in HKEY_CURRENT_USER while selecting for everybody would put the entries in HKEY_LOCAL_MACHINE. Obviously, choosing the former means that only the user that installed the software would be able to use it while the latter option would let everyone see and use the software.

Another key difference between HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER is who can edit it. The former can be edited by any user who has access to the registry while the latter can only be edited by the individual user. You cannot login to one account and edit the HKEY_CURRENT_USER entries on another account.

Lastly, there is the matter of when the registry entries are loaded. HKEY_LOCAL_MACHINE are loaded during the start-up of the operating system. In comparison, HKEY_CURRENT_USER is only loaded after the user logs-in to his account, which is quite reasonable as the OS would not know which HKEY_CURRENT_USER it would load. If the user does not log-in to a specific account or logs into the guest account, the default HKEY_CURRENT_USER settings would be loaded. For a new user, the HKEY_CURRENT_USER entries would also be the same as the default.

Summary:

1.HKEY_CURRENT_USER is only applicable to one user while HKEY_LOCAL_MACHINE is applicable to all
2.HKEY_LOCAL_MACHINE is always available while HKEY_CURRENT_USER for a specific user is only available when he logs-in
3.HKEY_LOCAL_MACHINE are loaded on start-up while HKEY_CURRENT_USER are loaded on log-in