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?

2 comments:

Arnab Chakraborty 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

Post a Comment