In powershell, è possibile ottenere un array di RegistryKeys
come segue:
$hkeys = Get-ChildItem HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Quando ho ispezionare il primo elemento di questo array, questo è quello che ottengo:
Hive: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
Name Property
---- --------
7-Zip DisplayName : 7-Zip 21.03 beta (x64)
DisplayVersion : 21.03 beta
DisplayIcon : C:\Program Files\7-Zip\7zFM.exe
InstallLocation : C:\Program Files\7-Zip\
UninstallString : "C:\Program Files\7-Zip\Uninstall.exe"
NoModify : 1
NoRepair : 1
EstimatedSize : 5237
VersionMajor : 21
VersionMinor : 3
Publisher : Igor Pavlov
Property
sembrava un po ' strano, così ho guardato ulteriormente che:
> $hkeys[0].property.gettype
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String[] System.Array
Gli elementi in property
attributo, dal momento che sono delimitate da due punti :
non sembra come corde, così ho guardato un po ' di più, ma ha scoperto che sono davvero String
oggetti:
> $hkeys[0].property[0].gettype
IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object
Dal momento che sembrava di essere oggetti string, ho provato a eco il primo. Tuttavia, si riporta solo la prima parte della stringa e non la parte dopo i due punti:
> $hkeys[0].property[0]
DisplayName
Sento che c'è qualcosa di fondamentale che non capisco qui. Sono gli elementi della matrice davvero String
gli oggetti? Se è così, perché non parte dopo i due punti compaiono?