Windows EXE files have some metadata like CompanyName
, FileVersion
, InternalName
, ProductName
, OriginalFileName
, ProductVersion
, etc.
How can I extract such metadata from using PHP?
Windows EXE files have some metadata like CompanyName
, FileVersion
, InternalName
, ProductName
, OriginalFileName
, ProductVersion
, etc.
How can I extract such metadata from using PHP?
I got curious about this, so I decided to write this function:
It works with 32-bit and 64-bit exe. Usage example:
notepad.exe (32-bit):
php.exe (32-bit):
jre-7u9-windows-x64.exe (64-bit):
Something interesting about
php.exe
: theComments
andURL
don't show up in the Details tab. At least in my computer.Enjoy.
Update 1: I forgot error checking. Now it returns null if the version info doesn't exist.
Update 2: Many thanks to @Abela for bringing an encoding issue to my attention.
I added an optional 2nd parameter that defaults to UTF-8 which should work for most purposes. If you need single-byte-character output, use ISO-8859-1 instead, like this: