There is some debate as to whether or not HKLM is an alias for HKEY_LOCAL_MACHINE. Some believe that HKLM is the real name for HKEY_LOCAL_MACHINE, while others believe that HKLM is an alias for HKEY_CURRENT_USER. The answer to this question may never be known, but it seems likely that HKLM is an alias for HKEY_LOCAL_MACHINE.


Sometimes when working with Windows, you see all manner of names, abbreviations, and identifiers such as HKLM and HKEY_LOCAL_MACHINE for example. Is HKLM simply an alias for HKEY_LOCAL_MACHINE or are there ‘differences’ between the two? Today’s SuperUser Q&A post has the answers to a curious reader’s question.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Screenshot courtesy of wandersick (Flickr).

The Question

SuperUser reader Joe Kearney wants to know if HKLM is just an alias for HKEY_LOCAL_MACHINE or if there really are differences between the two at times:

Is HKLM simply an alias for HKEY_LOCAL_MACHINE or are there actually some differences between the two?

C:>reg query “HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v “CurrentVersion” HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion CurrentVersion    REG_SZ    6. 1 C:>reg query “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion” /v “CurrentVersion” HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion CurrentVersion    REG_SZ    6. 1

Are there any references asserting that they are equivalent or that one is an alias for the other? Or are there, in fact, cases where they are not the same thing?

The Answer

SuperUser contributors Twinkles and john smith have the answer for us. First up, Twinkles:

Followed by the answer from john smith:

There are cases where abbreviating HKEY_LOCAL_MACHINE to HKLM is not permitted, for instance when defining a policy.

Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.