FileGetVersion

Retrieves the version of a file.

Version := FileGetVersion(Filename)

Parameters

Filename

Type: String

If omitted, the current file of the innermost enclosing file loop will be used. Otherwise, specify the name of the target file. If a full path is not specified, this function uses the search sequence specified by the system LoadLibrary function.

Return Value

Type: String

This function returns the version number of the specified file.

Error Handling

An OSError is thrown on failure, such as if the file lacks version information.

A_LastError is set to the result of the operating system's GetLastError() function.

Remarks

Most non-executable files (and even some EXEs) have no version, and thus an error will be thrown.

FileGetAttrib, FileSetAttrib, FileGetTime, FileSetTime, FileGetSize, file loop

Examples

Retrieves the version of a file and stores it in Version.

Version := FileGetVersion("C:\My Application.exe")

Retrieves the version of the file "AutoHotkey.exe" located in AutoHotkey's installation directory and stores it in Version.

Version := FileGetVersion(A_ProgramFiles "\AutoHotkey\AutoHotkey.exe")