Function Reference


Returns version information stored in a file.

FileGetVersion ( "filename" [, "stringname"] )


filename Filename.
stringname [optional] Name of the string field to be retrieved from the header version file info:
    $FV_COMMENTS ("Comments")
    $FV_COMPANYNAME ("CompanyName")
    $FV_FILEDESCRIPTION ("FileDescription")
    $FV_FILEVERSION ("FileVersion")
    $FV_INTERNALNAME ("InternalName")
    $FV_LEGALCOPYRIGHT ("LegalCopyright")
    $FV_LEGALTRADEMARKS ("LegalTrademarks")
    $FV_ORIGINALFILENAME ("OriginalFilename")
    $FV_PRODUCTNAME ("ProductName")
    $FV_PRODUCTVERSION ("ProductVersion")
    $FV_PRIVATEBUILD ("PrivateBuild")
    $FV_SPECIALBUILD ("SpecialBuild")

Constants are defined in FileConstants.au3.

Return Value

Success: The version number ("#.#.#.#" format) - or the content of the specified string field.
Failure: "" if no version information (or other error) or "" if string field not filled - @error flag set to 1.


Another special "stringname" is "DefaultLangCodepage" can be used to retrieve the default language and codepage.

The language and codepage can be used if needed to differentiate the "stringname" i.e. "080904b0\Comments" (see MSDN StringFileInfo in VerQueryValue function).

To get the version number of an AutoIt compiled script it is better to use the @AutoItVersion macro.


FileGetSize, FileGetTime


#include <MsgBoxConstants.au3>


Func Example()
    ; Retrieve the file version of the AutoIt executable.
    Local $sFileVersion = FileGetVersion(@AutoItExe)

    ; Display the file version. This should be equal to @AutoItVersion.
    MsgBox($MB_SYSTEMMODAL, "", $sFileVersion)
EndFunc   ;==>Example