Reputation: 422
How can I test which version number is bigger?
$Variable1:15.0.0.152
$Variable2:15.0.1.153
If want to write a simple if question like ($Variable1 -gt $Variable2)
Upvotes: 0
Views: 290
Reputation: 2542
Probably not the best solution, but you could try this:
[int]($Variable1.Split('.') -Join '') -gt [int]($Variable2.Split('.') -Join '')
UPDATE! This is what you want:
[System.Version]$Version = "15.0.0.15"
[System.Version]$Version2 = "15.0.1.15"
$Version -gt $Version2
Upvotes: 3