June 6, 2012

How to query HKEY_CLASSES_ROOT

The registry provider in PowerShell defines drives for HKEY_LOCAL_MACHINE and HKEY_CURRENT_USER (get-ps-drive). If you want to access HKEY_CLASSES_ROOT you have to define a new drive first :

New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT

Now you can do a  dir HKCR:

Ref : What, no HKCR in PowerShell?

6 comments:

Arnumb said...

HKEY_CLASSES_ROOT is an alias to HKLM\SOFTWARE\Classes.

ParadisJ said...

Thanks for your comment Arnab.
In fact your are almost right. HKEY_CLASSES_ROOT is a merge view from HKEY_LOCAL_MACHINE\Software\Classes and HKEY_CURRENT_USER\Software\Classes. So it's recommanded to use HKEY_CLASSES_ROOT to access all Classes.

Ref : http://msdn.microsoft.com/en-us/library/windows/desktop/ms724498(v=vs.85).aspx

raynnowui21 said...

You must take part in a contest for top-of-the-line blogs on the web. I'll suggest this site! casino slots

Anonymous said...

thanks unknown for
HKEY_CLASSES_ROOT is an alias to HKLM\SOFTWARE\Classes.

Andrzej said...

thanks for this, helped me a lot

PsychoData said...

HKEY_CLASSES_ROOT is NOT just an alias to HKLM\SOFTWARE\Classes

it is actually a "virtual" class combined from HKLM\SOFTWARE\Classes and HKCU\SOFTWARE\Classes

This is important because something that is at "HKEY_CLASSES_ROOT\$Item" might be at "HKLM\SOFTWARE\Classes\$Item" or "HKCU\SOFTWARE\Classes\$Item" - or both

Just throwing that out there! :)

Post a Comment