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

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche

Multiple line/array to one line

Multiple line/array

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

Output

10
0
14393
1607
2156

Format Multiple line/array to one line (with "." between each number) - 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