InstallShield 2018 » InstallScript Language Reference
The VerCompare function compares two strings that contain version information and returns whether the first one is less than, greater than, or equal to the second one.
Important • The format of the versions that you pass through the szVersionInfo1 and szVersionInfo2 parameters must be in the format w.x.y.z, where w, x, y, and z represent numbers. All four fields must be present; otherwise, VerCompare cannot successfully compare the two version strings.
For example, the following entries are valid szVersionInfo1 and szVersionInfo2 parameters:
• | "1.0.0.0" |
• | "10.10.20.10" |
• | "3.21.01.2" |
The following entries are not valid parameters:
• | "1.20" |
• | "1.12.3" |
• | "2" |
If one of the version strings has fewer than four fields, consider using the concatenate string operator (+) to add a decimal point and the number 0 as needed.
Syntax
VerCompare ( szVersionInfo1, szVersionInfo2, nCompareFlag );
Parameters
Parameter |
Description |
szVersionInfo1 |
Specify the first version string in the format w.x.y.z, where w, x, y, and z represent numbers. |
szVersionInfo2 |
Specify the second version string in the format w.x.y.z, where w, x, y, and z represent numbers. |
nCompareFlag |
Specify the predefined constant VERSION to indicate that you are comparing version numbers. No other values are allowed in this parameter. |
Return Values
Return Value |
Description |
EQUALS (2) |
Indicates that the two strings are of equal value. |
LESS_THAN (1) |
Indicates that the first string contains a value less than the second. |
GREATER_THAN (0) |
Indicates that the first string contains a value greater than the second. |
ISERR_GEN_FAILURE (-1) |
Indicates that the function could not compare the two strings. |
See Also
InstallShield 2018 Help LibrarySeptember 2018 |
Copyright Information | Flexera |