File.GetVersionInfo

table File.GetVersionInfo ( 

string Filename )

Example 1

version_info = File.GetVersionInfo( _ProgramFilesFolder .. "\\Doopernator\\Doopernator.exe");
fv = version_info.FileVersion;
pv = version_info.ProductVersion;

Gets the version info for the "C:\Program Files\Doopernator\Doopernator.exe" file and stores it in a table named version_info. Then copies the file version and product version from that table into variables named fv and pv, respectively.

Note: _ProgramFilesFolder is a built-in variable that contains the path to the user's Program Files directory.

Example 2

-- Get the file information, and load it into a table
tVersionInfo = File.GetVersionInfo(_SourceFolder .. "\\setup.exe");

-- Get the last error code
nError = Application.GetLastError();
if nError == 0 then
    -- There was not an error
    sOutput = "";

    -- Traverse the table, storing info in a string
    for Name, Contents in pairs(tVersionInfo) do
        sOutput = sOutput .. Name .. ": " .. Contents .. "\r\n";
    end

    -- Output string contents to the user
    Dialog.Message("File Version Information", sOutput);
else
    -- There was an error, alert the user
    Dialog.Message("Error", _tblErrorMessages[nError]);
end

Retrieves the version information from the file "setup.exe, and presents it to the user in a single dialog message.

Note: _SourceFolder is a built-in variable that contains the path to the location the setup.exe is run from.

See also:  Related Actions