我不谈我可以通过下面的脚本获得的文件版本:
Set args = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
WScript.Echo fso.GetFileVersion("somedll.dll")
Wscript.Quit如何获取在GAC中可见的dll版本?
谢谢
发布于 2014-08-20 22:53:53
您可以使用gacutil来搜索您的程序集,并将输出写入一个文本文件,然后可以对其进行解析。
例如:
Const GACUTIL_PATH = "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe"
Const ASSEMBLY_NAME = "System.Web.Mobile"
Const TEMP_FILE = "c:\out.txt"
' Run the gacutil.exe utility....
With CreateObject("WScript.Shell")
.Run Chr(34) & GACUTIL_PATH & Chr(34) & " /nologo /l " & ASSEMBLY_NAME & " >" & TEMP_FILE, 0, True
End With
' Read the output file...
With CreateObject("Scripting.FileSystemObject")
strOutput = .OpenTextFile(TEMP_FILE).ReadAll()
End With
' Find the "Version" attribute...
With New RegExp
.Global = True
.Pattern = "Version=(\d+\.\d+\.\d+\.\d+),"
Set Matches = .Execute(strOutput)
End With
' Display each version in the GAC...
For Each Match In Matches
MsgBox Match.SubMatches(0)
Nexthttps://stackoverflow.com/questions/25399255
复制相似问题