Executable file version test

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
Wabiloo
Posts: 26
Joined: Thu Jun 05, 2008 12:15 am

Executable file version test

Post by Wabiloo »

Is there a way to check and return the version of an executable (.exe or .dll) file?

In windows, when you select such a file, and look at the properties, under "Details", most have a "File Version" (eg. 2.0.10.234).
I need a test that will be able to check that and return the version as a "reply". If possible, I would also need to check how the answer compares to a value I set (to check whether the version is older or newer than the set one)
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You may create Java or VB script and use this script with Active Script or Shell Script test methods
http://www.ks-soft.net/hostmon.eng/mfra ... htm#script
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

E.g. JScript for Shell Script test may look like

Code: Select all

statusOk          = "ScriptRes:Ok:"
statusBad         = "ScriptRes:Bad:"
statusUnknown     = "ScriptRes:Unknown:"

var fso, filename, filever = "";
filename = "c:\\hostmon7\\hostmon.exe";
fso = new ActiveXObject("Scripting.FileSystemObject");
filever = fso.GetFileVersion(filename);
WScript.StdOut.Write(statusOk+':'+filever);
Compare version? "Version" is a text string, in general case it may be difficult to compare versions for various files. However if you need to check version of some specific file, its pretty easy to compare strings...

Regards
Alex
Post Reply