I'm trying to sort version numbers in an array, starting with the highest and descending to the lowest.
An example of the version numbers I'm trying to sort would be W88.1.1.
All I've really tried is:
$a = "W99.2.9", "W99.2.8", "W99.2.3", "W99.2.7" | Sort-Object -Descending
The [System.Version] object type cast should do the trick:
PS > [System.Version]"2.7.0.19530" -gt [System.Version]"3.0.0.4080"
False
PS > [System.Version]"2.7.0.19530" -lt [System.Version]"3.0.0.4080"
True
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With