FindVersion function

Find the product version of a .exe/.dll file and store it in the indicated variable as a.b.c.d, suitable for version testing and general conditions. Optionally, this function searches App Paths and %PATH%. If the file is not found or if it does not have an embedded version number, the variable is set to an empty string.

Tip: If you know exactly where the file resides that you want to obtain the version from, it is probably easier to use one of the $fverf or $fverp runtime functions.

The FindVersion function is a predefined extension DLL function that is distributed with InstallMate. You can use this function by adding a Run DLL action to the action sequence in which you want to run the action. Set the Run DLL action attributes as follows:


The FindVersion function expects the following arguments. All arguments may contain symbolic references; these will be resolved before the function is called. Note that you must "quote" an argument if it contains spaces, or if it could contain spaces after expansion of symbolic references.

The fully qualified file path, or just its name + extension. The FindVersion will first try to locate the file with the path as given; if that fails and if the flags argument allows further searching, then FindVersion will search various paths for only the name + extension of the file and use the first match, if any.
The sum of zero or more of the following:
1 - Search the files listed under the App Paths registry key
2 - Search the paths listed in the %PATH% environment variable
The name of the variable to which to assign the version number of the file, if found. If not found or if it the file does not have an embedded version number, the variable is set to an empty string.

Return value

Returns ERROR_SUCCESS (zero) if successful, else a nonzero error code. This error code is available in the LastExitCode variable. To find out if the version number was found, test the varname variable.


To use this function, you must add the extension DLL to your InstallMate project. The easiest way to do so is as follows:

  1. Open your InstallMate project.
  2. Choose File > Import > Project Items... from the main menu bar.
  3. Browse for and select the file Insert Extension DLL.imq, then click Open.

Alternatively, you can go to the Installer options page in your InstallMate project, click on the Advanced... button, then click on the Extension DLL tab and enter the paths to the extension DLL versions there.