FileGetVersion

Retrieves the version of a file.

FileGetVersion, OutputVar , Filename

Parameters

OutputVar

The name of the output variable in which to store the version number/string.

Filename

If blank or 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 command uses the search sequence specified by the system LoadLibrary function.

Error Handling

[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.

ErrorLevel is set to 1 if there was a problem or 0 otherwise.

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

Remarks

Most non-executable files (and even some EXEs) won't have a version, and thus OutputVar will be blank in these cases.

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

Examples

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

FileGetVersion, Version, C:\My Application.exe

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

FileGetVersion, Version, %A_ProgramFiles%\AutoHotkey\AutoHotkey.exe