Board logo

标题: 如何用VBS读取文件*.DLL *.EXE的文件版本信息,系统属性等 [打印本页]

作者: piziliu2004     时间: 2010-1-4 18:46    标题: 如何用VBS读取文件*.DLL *.EXE的文件版本信息,系统属性等

如题:如何用VBS读取文件*.DLL  *.EXE的文件版本信息,系统属性等
作者: qinchun36     时间: 2010-1-4 20:06

Function GetVersion(pathspec)
   Dim fso, temp
   Set fso = CreateObject("Scripting.FileSystemObject")
   temp = fso.GetFileVersion(pathspec)
   If Len(temp) Then
      GetVersion = temp
   Else
      GetVersion = "无可用版本信息!"
   End If
End Function


Function GetAttributes(pathspec)
   Dim fso, f, temp, str
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(pathspec)
   temp = f.Attributes
   str = ""
   If temp and 4 Then str = str & "系统"
   If temp and 2 Then str = str & "隐藏"
   If temp and 1 Then str = str & "只读"
   If str = "" Then str = "普通"
   GetAttributes = str
End Function


filepath = "C:\Windows\system32\shell32.dll"
msgbox filepath & " 的版本是 " & GetVersion(filepath)
msgbox filepath & " 的属性是 " & GetAttributes(filepath)
[ Last edited by qinchun36 on 2010-1-5 at 10:00 ]
作者: piziliu2004     时间: 2010-1-4 21:46
Thanks. 2楼。 呵呵之前一直没找到GetFileVersion函数,呵呵