InstallShield 2019 » InstallScript Language Reference
The VerFindFileVersion function searches for a specified file and retrieves the file version and location.
VerFindFileVersion uses the following search algorithm to find the file (searches the folders in the following order):
1. | Windows folder |
2. | Windows system folder |
3. | The folder specified by the TARGETDIR system variable (in InstallScript installations) or the INSTALLDIR system variable (in Basic MSI and InstallScript MSI installations) |
4. | The folders specified by the PATH environment variable |
5. | The folder from which Setup.exe is running |
For information about the Windows system folder, see the documentation for the InstallScript system variable WINSYSDIR.
Note • When using VerFindFileVersion, you might need to set a value for TARGETDIR (in InstallScript installations) or INSTALLDIR (in Basic MSI and InstallScript installations) other than the value that is automatically set by the InstallScript engine. Since the function looks for the file in the TARGETDIR or INSTALLDIR folder, you might need to reset the value of the system variable temporarily to ensure that VerFindFileVersion finds the file. If you need to do this, use VarSave to save the value of TARGETDIR or INSTALLDIR before temporarily setting it to another folder. After the VerFindFileVersion function call, reset TARGETDIR or INSTALLDIR using VarRestore.
Syntax
VerFindFileVersion ( szFileName, svPath, svVersionNumber );
Parameters
Parameter |
Description |
szFileName |
Specifies the unqualified name of the file whose version is to be obtained. Do not specify a drive designation or path in this parameter. |
svPath |
Returns the complete path (including the drive designation) to the folder in which the file resides. |
svVersionNumber |
Returns the version number of the file in the following format: <major version>.<minor version> For example, if svVersionNumber returns 2.1.2.0, the major version number is 2.1 and the minor version number is 2.0. |
Return Values
Return Value |
Description |
0 |
Indicates that the function successfully returned the version information. |
FILE_NO_VERSION (-8) |
Indicates that the file was found but did not contain version information. |
FILE_NOT_FOUND (-2) |
Indicates that the file was not found. |
See Also
InstallShield 2019 Help LibraryApril 2019 |
Copyright Information | Flexera |