FileGetVersionInfo()

Author: SKAN, wOxxOm Last Modified: nonexistent


Extracts and returns version information ( any one at a time ) from an executable file.

AHK's FileGetVersion command will fetch you the FileVersion, but there are more - that this function would fetch. Following are Windows Standard Names

* Comments
* CompanyName
* FileDescription
* FileVersion
* InternalName
* LegalCopyright
* LegalTrademarks
* OriginalFilename
* PrivateBuild
* ProductName
* ProductVersion
* SpecialBuild

FileGetVersionInfo( peFile="", StringFileInfo="" )

For the functions's parameters and return value, please see it's source code.

Remarks

Credit: ::script::GetFullVersionInfo string version info for execs by wOxxOm
o http://www.autohotkey.com/forum/viewtopic.php?p=52148#52148

Reference: How to extract version information using the Windows API Peter D Johnson
o http://www.autohotkey.com/forum/viewtopic.php?p=52148#52148

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?p=233188#233188

License

nonexistent

Example

; #Include FileGetVersionInfo.ahk
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

SetBatchLines -1
Loop, %A_WinDir%\System32\*.??l
  Files .= "|" A_LoopFileLongPath
Files := A_AhkPath . Files

Loop, Parse, Files, |
  MsgBox, 0, % (PeFile:=A_LoopField)
  , % "FileDescription      `t:`t" FileGetVersionInfo( PeFile, "FileDescription"  ) "`n"
    . "FileVersion          `t:`t" FileGetVersionInfo( PeFile, "FileVersion"      ) "`n"
    . "InternalName         `t:`t" FileGetVersionInfo( PeFile, "InternalName"     ) "`n"
    . "LegalCopyright       `t:`t" FileGetVersionInfo( PeFile, "LegalCopyright"   ) "`n"
    . "OriginalFilename     `t:`t" FileGetVersionInfo( PeFile, "OriginalFilename" ) "`n"
    . "ProductName          `t:`t" FileGetVersionInfo( PeFile, "ProductName"      ) "`n"
    . "ProductVersion       `t:`t" FileGetVersionInfo( PeFile, "ProductVersion"   ) "`n`n`n"
    . "CompanyName          `t:`t" FileGetVersionInfo( PeFile, "CompanyName"      ) "`n"
    . "PrivateBuild         `t:`t" FileGetVersionInfo( PeFile, "PrivateBuild"     ) "`n"
    . "SpecialBuild         `t:`t" FileGetVersionInfo( PeFile, "SpecialBuild"     ) "`n"
    . "LegalTrademarks      `t:`t" FileGetVersionInfo( PeFile, "LegalTrademarks"  ) "`n"