A Windows Batch file to check the version of executables (program files, DLL files, …) by processing lists of files and reference version numbers.
mysigchk.bat [/v] LISTFILE [LISTFILE ...]
mysigchk.bat
reads file names including paths and version numbers from LISTFILE. It then retrieves the version of the files and reports files with non-matching numbers. Non-existing files are ignored unless mysigchk.bat
is started with /v
.
We use mysigchk.bat
to scan computers for old outdated applications or missing installations. There's a number of applications out there for this task but generally they are rather bloated, come with a number of dependencies and are hard to automate. mysigchk.bat
follows the KISS principle. However, it checks only files that we want it to check, and we have to update the version numbers manually. Eventually, the later can be an advantage in cases where one deliberately wants to keep an older version of a program.
LISTFILE is |
(pipe) delimited. The syntax of LISTFILE is
[Path\]Filename|Version|Comment
1 file per line. Empty lines and lines starting with #
are ignored.
If Path
starts with ~
, ~
will be substituted with a fixed list of directories commonly used for program files. This list is hard coded (but can be easily spotted in the script). The list currently is: C:\Programs,"C:\Program Files",C:\Programme,"C:\Program Files (x86)"
If Comment
is the single word required
, mysigchk.bat
will report if the file was not found. All other text in Comment
is ignored and can be used for comments.
If Version
is empty mysigchk.bat
will report the version number using the syntax of LISTFILE. So, a LISTFILE with no Version
numbers can be used to create a file with the current status of version numbers.
The script uses a helper script getversion.vbs
to retrieve the version number of the files (download below). In order for mysigchk.bat
to work, just download both scripts into the same folder. Otherwise, one needs to change the path to getversion.vbs
in mysigchk.bat
.
Previously, mysigchk.bat
was a wrapper around Sysinternals' sigcheck. Later, we found that a simple VBS script works as well, in fact, it's even faster. The old version of mysigchk.bat
is still available though: mysigch1.bat (1 KB, last update 2012-09-21)
mysigchk.bat filestocheck.dat mysigchk.bat filestocheck1.dat filestocheck2.dat mysigchk.bat filestocheck*.dat
~\putty\putty.exe ~\Mozilla Firefox\firefox.exe ~\Mozilla Thunderbird\thunderbird.exe
If you have these programs installed in their default directories running mysigchk.bat initial.dat
should return something like
C:\Program Files\putty\putty.exe|0.62.0.0 C:\Program Files\Mozilla Firefox\firefox.exe|15.0.1.4631 C:\Program Files\Mozilla Thunderbird\thunderbird.exe|15.0.1.4633
So, this could then be stored as a new LISTFILE, modified and checked again.
~\putty\putty.exe|0.62.0.0 C:\Program Files\putty\putty.exe|0.62.0.0|required # Firefox and Thunderbird ~\firefox\firefox.exe|15.0.1.4631 ~\Mozilla Firefox\firefox.exe|15.0.1.4631 ~\thunderbird\thunderbird.exe|15.0.1.4633 ~\Mozilla Thunderbird\thunderbird.exe|15.0.1.4633 # Adobe Acrobat 10 ~\Adobe\Acrobat 10.0\Acrobat\Acrobat.exe|10.1.4.38 # Adobe Reader X/Adobe Reader 10 ~\Adobe\Reader 10.0\Reader\AcroRd32.exe|10.1.4.38 ~\Adobe\Reader 10.0\Reader\AcroRd32.dll|10.1.4.38 ~\Adobe\Reader 10.0\Reader\plug_ins\EScript.api|10.1.4.38 ~\Adobe\Reader 10.0\Reader\plug_ins\Annots.api|10.1.4.38 # Foxit Reader ~\pdfreader\Foxit Reader.exe|5.4.2.901 ~\Foxit Reader\Foxit Reader.exe|5.4.2.901 ~\Foxit Software\Foxit Reader\Foxit Reader.exe|5.4.2.901 # Miscellaneous ~\irfanview\i_view32.exe|4.33 ~\totalcmd\totalcmd.exe|8.0.1.0 ~\vlc\vlc.exe|2.0.3.0 ~\VideoLAN\vlc.exe|2.0.3.0 ~\VideoLAN\VLC\vlc.exe|2.0.3.0 ~\winamp\winamp.exe|5.6.3.3234 ~\winscp\winscp.exe|4.3.9.1817 ~\winscp3\winscp.exe|4.3.9.1817 ~\SumatraPDF\SumatraPDF.exe|2.1.1.0.0 # Microsoft ~\Microsoft Security Client\MsMpEng.exe|4.0.1526.0
2009-12-01 First usable version, provided to colleagues 2012-09-03 Added placeholder ~ (tilde) to look for files in common dirs 2012-09-21 Updated script and made it publicly available 2012-09-24 Replaced sigcheck.exe with getversion.vbs
I have tested this only on some Windows XP, and Windows 7 installations. It's my first attempt at using batch file extensions, delayed expansion and variable modifiers. Use at your own risk.
This script is free software. Use it as you please. It comes without any warranties, though.
Andreas Schamanek, 2012-09-25 00:22
Ideally, the 2 scripts would be merged into 1 VBS script, I guess, but unfortunately, I never wrote VBS scripts. If anyone could give me some hints on how to convert the batch file to a VBS, I'd be happy to give it a try.
Michael Shvartsman, 2014-10-01 18:59, edited 2014-10-02 00:16
Hallo Andreas,
vielen Dank für Ihre Scripte. Sie sind für mich sehr hilfreich, um in Netzwerk Dateiversionen zu ermitteln. Leide in gemischte Landschaft (WIN XP und WIN7) muss man immer separat mit Einträgen im filestocheck.dat im Form z.B. \\PCxx\C$\Programme\Mozilla Firefox\firefox.exe
bzw. \\PCxxxx\C$\Program Files (x86)\Mozilla Firefox\firefox.exe
arbeiten weil Ihre ~
funktioniert nur "if 1st char of file (%%A) is ~ create a list of usual suspect paths". Was soll (darf) man genau im mysigchk.bat ändern, um "~ Funktion" an richtige Stelle zu nutzen (mit antworten in Form \\PCxxxx\……..\*.exe|xx.yy.zz
Freundliche Grüsse
Michael
Andreas Schamanek, 2014-10-02 00:21
@Michael: Ich hab es nie selbst mit UNC-Pfaden probiert. Aber wenn es grundsätzlich funktioniert, müsste man sie mit dem ~
-Platzhalter verwenden können. Das heißt, Du erweiterst oder ersetzt die Liste in der Zeile
FOR %%P IN ("C:\\Program Files","C:\\Programme","C:\\Program Files (x86)") DO (
z.B.
FOR %%P IN ("\\\PC01\\C$\\Programme","\\\PC02\\C$\\Programme","\\\PC03\\C$\\Programme") DO (
Dann sollte es funktionieren mit
~\\Mozilla Firefox\\firefox.exe|...usw