我不会谈论我可以通过以下脚本获得的文件版本:
Set args = WScript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
WScript.Echo fso.GetFileVersion("somedll.dll")
Wscript.Quit
如何获得可见的dll版本,例如在GAC?
由于
答案 0 :(得分:1)
您可以使用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)
Next