适用于所有版本。
在先前的技巧中我们知道如何用一行命令获取多行注册表记录,这里,我们再来回顾下这段代码:
$lookup = Get-ItemProperty Registry::HKCR\.[a-f]?? | Select-Object -Property PSChildName, '(default)', ContentType, PerceivedType | Group-Object -Property PSChildName -AsHashTable -AsString
PS> $lookup.'.avi'PSChildName (default) ContentType PerceivedType ----------- --------- ----------- ------------- .avi WMP11.AssocFile.AVI video
PS> $lookup.'.fon'
PSChildName (default) ContentType PerceivedType ----------- --------- ----------- ------------- .fon fonfile
只需要记住这里限定了3个且已a-f开头的文件。要获得全部,只需要替换一下即可:
Registry::HKCR\.*