/*
FileDescription 文件描述说明
FileVersion 文件版本
InternalName 内部名称
LegalCopyright 法律版权所有
OriginalFilename 创建文件时所使用的名称
ProductName 产品名称
ProductVersion 产品版本
CompanyName 企业名称
PrivateBuild 私有版本的信息
SpecialBuild 特殊内部版本信息
LegalTrademarks 文件的商标和注册商标
*/
MsgBox % FileGetInfo("D:\PSTools\Hash.exe", "ProductVersion")
FileGetInfo(FilePath:="", p*) { ; Written by SKAN, modified by HotKeyIt ; www.autohotkey.com/forum/viewtopic.php?p=233188#233188 CD:24-Nov-2008 / LM:27-Oct-2010
static DLL:="Version\GetFileVersion"
If ! FSz := DllCall( DLL "InfoSize" (A_IsUnicode ? "W" : "A"), "Str",FilePath, "UInt",0 )
Return DllCall( "SetLastError", UInt,1 ),""
VarSetCapacity( FVI, FSz, 0 ),DllCall( DLL "Info" ( A_IsUnicode ? "W" : "A"), "Str",FilePath, "UInt",0, "UInt",FSz, "PTR",&FVI )
If !DllCall( "Version\VerQueryValue" (A_IsUnicode ? "W" : "A"), "PTR",&FVI, "Str","\VarFileInfo\Translation", "PTR*",Transl, "PTR",0 )
Return DllCall( "SetLastError", UInt,2 ),""
If !Trans:=format("{1:.8X}",NumGet(Transl+0,"UInt"))
Return DllCall( "SetLastError", UInt,3),""
for k,v in p
{
subBlock := "\StringFileInfo\" SubStr(Trans,-3) SubStr(Trans,1,4) "\" v
If ! DllCall( "Version\VerQueryValue" ( A_IsUnicode ? "W" : "A"), "PTR",&FVI, "Str",SubBlock, "PTR*",InfoPtr, "UInt",0 )
continue
If Value := StrGet( InfoPtr )
Info .= p.MaxIndex()=1?Value:SubStr( v " ",1,24 ) . A_Tab . Value . "`n"
}
Info:=RTrim(Info,"`n")
Return Info
}
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。

评论(0)