All versions
PowerShell code can be extremely dense. Here is a one-liner that reads all associated file extensions from the Windows Registry:
Get-ItemProperty Registry::HKCR\.* | Select-Object -Property PSChildName, '(default)', ContentType, PerceivedType
Note a couple of tricks: Get-ItemProperty uses the provider name “Registry::” instead of the registry drives PowerShell provides. This way, you can use default registry paths, and for example access hives like HKEY_CLASSES_ROOT that has no drive.
Note also how Select-Object selects the registry values to retrieve. There are two special names here: “(default)” always represents the default registry value, and “PSChildName” always represents the registry key name that contains the values you are reading.
Because of the “*” in the path name, the command automatically reads all keys in HKCR that start with a dot.