The $fverfcmp function compares the file version of the file specified by path with the version specified by version and returns a value < 0, 0, or > 0 depending on the comparison result:
|File version(path) < version||< 0|
|File version(path) = version||0|
|File version(path) > version||> 0|
The result can be used in conditional expressions; see Examples below.
If path does not refer to a file, if the file does not exist, or if the file does not have a VERSIONINFO resource, then its file version is treated as if it were 0.0.0.0.
The version parameter must consist of up to 4 decimal numbers separated by periods: a.b.c.d, from most to least significant. You may leave off less significant numbers; any missing numbers are treated as 0. Therefore, 18.104.22.168, 2.1.0 and 2.1 are equivalent.
The comparison is done numerically, not as text. This means, for example, that if the file version of path is 2.19, then $fverfcmp(path, 2.2) is > 0, because 19 > 2. It also means that 2.2 and 2.20 are not the same version (but 2.2 and 2.2.0 are).
Tip: To compare product versions instead of file versions, use the $fverpcmp function.
All parameters may contain symbolic references; these are resolved before the function is applied. See Examples below.
- File path of the file whose file version must be compared.
- Version for the comparison.
Here are some usage examples for this function:
- <$fverfcmp(<WindowsFolder>\Notepad.exe, 5)>
- Returns < 0 if the Notepad.exe file version is < 22.214.171.124, 0 if it is 126.96.36.199, and > 0 if it is > 188.8.131.52.
- <$fverfcmp(<WindowsFolder>\Notepad.exe, 5)> >= 0
- Conditional expression that evaluates to TRUE if the Notepad.exe file version is 184.108.40.206 or greater, or FALSE if not.
- <$fverfcmp(<WindowsFolder>\Notepad.exe, <MinVersion>)> >= 0
- Conditional expression that evaluates to TRUE if the Notepad.exe file version is greater than or equal to <MinVersion>, or FALSE if not. <MinVersion> should evaluate to something that can be parsed as a version number.