Multiple line or array to one line (Example: Windows Version)

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

Multiple line or array to one line

Multiple line or array

 CurrentMajorVersionNumber","CurrentMinorVersionNumber","CurrentBuildNumber","ReleaseId","UBR" | foreach {((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").$_)}

Output

10
0
14393
1607
2156

Format Multiple line or array to one line (with "." between) - Display Windows Version (incl. Patchlevel)

 ("CurrentMajorVersionNumber","CurrentMinorVersionNumber","CurrentBuildNumber","ReleaseId","UBR" | foreach {((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").$_)}) -join "."

Output

10.0.14393.1607.2156