You can use the FileSystemObject
object to access the file system and its GetFileVersion
method to obtain the file version information.
You asked for a VBScript example, so here you are:
Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
PrintDLLVersions oFSO.GetFolder(WScript.Arguments.Item(0))
Sub PrintDLLVersions(Folder)
Dim oFile, oSubFolder
' Scan the DLLs in the Folder
For Each oFile In Folder.Files
If UCase(oFSO.GetExtensionName(oFile)) = "DLL" Then
WScript.Echo oFile.Path & vbTab & oFSO.GetFileVersion(oFile)
End If
Next
' Scan the Folder's subfolders
For Each oSubFolder In Folder.SubFolders
PrintDLLVersions oSubFolder
Next
End Sub
Usage:
> cscript //nologo script-file.vbs folder > out-file
e.g.:
> cscript //nologo dll-list.vbs C:\Dir > dll-list.txt
Sample output:
C:\Dir\foo.dll 1.0.0.1
C:\Dir\bar.dll 1.1.0.0
C:\Dir\SubDir\foobar.dll 4.2.0.0
...