I've been asked to build a tool to compare DLL from differents directories. For each DLL file found in a specified folder, I need to write it's version, date last modified and size. For the 2 last infos, I managed to get them by the properties of the File object. Does anyone knows how to get the DLL version (shown on the "Version" tab of the "properties" window of a dll file in explorer).
Here is the code I wrote for the moment (Note : this is a full client tool called with a "file:\\..." type Url) :
...
Here are checks on input contents that are OK.
...
This is here I need to get the real version instead of the "Hard coded" V1R1L1 :
This is here I need to get the real version instead of the "Hard coded" V1R1L1 :
Water is not bad as long as it stays out human body ;-)
Here is the code I wrote for the moment (Note : this is a full client tool called with a "file:\\..." type Url) :
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head id="Entete">
<title>Récupération des infos DLL</title>
<LINK rel='stylesheet' type='text/css' href='./InfosDll_fichiers/Style.css'>
<script language="vbscript">
'*********************************************************
option explicit
' *** VARIABLES GLOBALES ***
dim fs, outFile
dim scanRep, outRep
dim getVers, getDate, getSize, nbInfos
' *** Initialisations GLOBALES ***
Set fs = CreateObject("Scripting.FileSystemObject")
'*********************************************************
function Verif()
'*********************************************************
dim oHTM_tmp, nbDll
Here are checks on input contents that are OK.
...
Code:
' *** Verif des options ***
nbInfos = 0
getVers = false
getDate = false
getSize = false
' Taille
Set oHTM_tmp = document.getElementById("ck_Size")
if oHTM_tmp.checked Then
getSize = true
nbInfos = nbInfos + 1
End if
' Date
Set oHTM_tmp = document.getElementById("ck_Date")
if oHTM_tmp.checked Then
getDate = true
nbInfos = nbInfos + 1
End if
' Version
Set oHTM_tmp = document.getElementById("ck_Vers")
if oHTM_tmp.checked Then
getVers = true
nbInfos = nbInfos + 1
End if
if nbInfos = 0 then
Msgbox "Vous n'avez selectionné aucune information à afficher !!!"
oHTM_tmp.focus
exit function
End if
Set oHTM_tmp = document.getElementById("MyBody")
oHTM_tmp.style.cursor = "wait"
Set outFile = fs.OpenTextFile(outRep & "InfosDLL.txt", 2, True)
nbDll = GetAllDlls()
outFile.close
oHTM_tmp.style.cursor = "auto"
if Msgbox (nbDll & " ont été scannées, voulez-vous visualiser le résultat ?", vbYesNo) = vbYes Then
dim wsh
Set wsh = CreateObject("Wscript.Shell")
wsh.run "Notepad.exe " & outRep & "InfosDLL.txt",1,false
set wsh = nothing
End if
set fs = nothing
End Function
'*********************************************************
function GetAllDlls()
'*********************************************************
dim oRep, oFic, oLstFics, nbDll, nbFics, curFic, curPercent
nbDll = 0
Set oRep = fs.GetFolder(scanRep)
Set oLstFics = oRep.Files
nbFics= oLstFics.count
curFic = 0
curPercent = 0
for each oFic in oLstFics
if Cint((100 * curFic) / nbFics) <> curPercent Then
curPercent = Cint((100 * curFic) / nbFics)
window.status = "Scan du répertoire : " & curPercent & "%"
End if
if(lcase(right(oFic.name,3)) = "dll") Then
call GetDllInfos(oFic)
nbDll = nbDll + 1
End if
curFic = curFic + 1
Next
GetAllDlls = nbDll
End Function
'*********************************************************
function GetDllInfos(oFicDll)
'*********************************************************
call outFile.Write(oFicDll.name)
if getVers Then
Code:
call outFile.Write(chr(9) & "V1R1L1")
Code:
End if
if getDate Then
call outFile.Write(chr(9) & oFicDll.dateLastModified )
End if
if getSize Then
call outFile.Write(chr(9) & oFicDll.size )
End if
call outFile.WriteLine("")
End Function
'*********************************************************
</script>
</head>
<body id="MyBody" style="TEXT-ALIGN: center">
<H1>Récupération des infos DLL</H1>
Selectionnez un répertoire et les informations que vous désirez sur les DLL.<BR />
L'outil va créer un fichier "infosDLL.txt" dans le répertoire de sortie spécifié.<BR />
Ce fichier contiendra toutes les informations choisies sur toutes les DLL du répertoire scanné.<BR/>
<BR/>
<BR/>
<table width="90%" border="0" style="border-style : outset; border-width : thin;" cellpadding="5px" cellspacing="1px" ID="Table1">
<tr>
<td class="Titre" colspan="2" align="left">répertoires :</td>
</tr>
<tr>
<td><FONT class="Lib">Répertoire à scanner : </FONT></td>
<td><input type="Text" name="RepToScan" size="100" ID="RepToScan"> </td>
</tr>
<tr>
<td><FONT class="Lib">Répertoire de sortie : </FONT></td>
<td><input type="Text" name="RepOut" size="100" ID="RepOut"></td>
</tr>
</table>
<BR/>
<BR/>
<table width="50%" border="0" style="border-style : outset; border-width : thin;" cellpadding="5px" cellspacing="1px">
<col width="80%"/>
<col width="20%"/>
<tbody>
<tr>
<td class="Titre" colspan="2" align="left">Options :</td>
</tr>
<tr>
<td class="Libelle" align="right">Afficher la version de DLL : </td>
<td align="left"><input type="checkbox" name="ck_Vers" ID="ck_Vers" checked></td>
</tr>
<tr>
<td class="Libelle" align="right">Afficher la date de dernière modification : </td>
<td align="left"><input type="checkbox" name="ck_Date" ID="ck_Date" checked></td>
</tr>
<tr>
<td class="Libelle" align="right">Afficher la taille du fichier : </td>
<td align="left"><input type="checkbox" name="ck_Size" ID="ck_Size" checked></td>
</tr>
</tbody>
</table>
<BR/>
<BR/>
<input type="button" style="width : 150px;" value="Valider" onClick="Verif()"/>
</body>
</html>