Get Fileversion

Dieses kleine Helferlein ermittelt die Dateiversion einer anzugebenen Datei.
Entweder als Befehlszeilenargument oder per Drag and Drop... 

Ach so, das ganze dann auch eingebunden in eine Batch...

for /f %%a in ('cscript.exe "%~dp0get_fileversion.vbs" "%ProgramFiles%\Microsoft Lync\communicator.exe"') do set cversion=%%a
echo %cversion%

Sinn und Zweck:
Nur bei einer bestimmten Dateiversion soll ein Patch angewendet werden.

set oargs = wscript.arguments
if oArgs.Count <>1 then
wscript.echo VBCRLF & "! FEHLER !" & VBCRLF & "! Fehlender Parameter !" & VBCRLF & "Syntax: Voller Pfad zur Datei"
wscript.quit
End if
Set WShell = CreateObject("WScript.Shell")
Set fso = CreateObject("scripting.filesystemobject")
progfiles = wshell.expandenvironmentstrings("%PROGRAMFILES%")
pathspec =oargs(0)

 s = fso.GetFileVersion(pathspec)
  if s = "" then
    s = "No version information available."
end if 
  wscript.echo s

 

  • Mittwoch, 14 März 2018

Leave a comment

You are commenting as guest.