Last active
May 9, 2018 02:00
-
-
Save trashvin/1c22821d54300bdeec7eed7707b28df9 to your computer and use it in GitHub Desktop.
Powershell : Check if JRE version is met
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$version = &"java.exe" -version 2>&1 | |
$version = $version[0].tostring() | |
$start = $version.IndexOf('"') | |
$version = $version.Remove(0,$start-1).Replace('"','').Trim() | |
$required = "1.8.0_114" | |
$result = $version.CompareTo($required) | |
if($result -eq 0) { | |
return 1 | |
} elseif ($result -gt 0) { | |
return 1 | |
} else { | |
return 0 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment