Link to home
Start Free TrialLog in
Avatar of grummite
grummite

asked on

How do I obtain the 'product version' of an executable using vbscript?

I am trying to obtain the product version a EXE file using vbscript.  The "product version" is visable in Windows XP by right-clicking on the EXE file, go to the Version tab and the "product version" is listed as one of the item names.   Anyone know how to obtain this version info using a vbs file.

Avatar of yehudaha
yehudaha
Flag of Israel image

you can try this
edit this line to the path and file name you need
notice every backslash need to be double
example: c:\\windows\\system32\\ping.exe

 ("Select * from CIM_Datafile Where name = 'C:\\temp\\setup.exe'")

one more thing file version and product version are diffrent attributes but in most cases are the same
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
    ("Select * from CIM_Datafile Where name = 'C:\\temp\\setup.exe'")
For Each objFile in colFiles
    Wscript.Echo "Version: " & objFile.Version
Next

Open in new window

Avatar of grummite
grummite

ASKER

Thanks for the assistance but I was trying to find the "product version" not the "file version".  The executable I am querying has different values for these two properties.  The "product version" is visable in Windows XP by right-clicking on the EXE file, go to the Version tab and the "product version" is listed as one of the item names.
ASKER CERTIFIED SOLUTION
Avatar of yehudaha
yehudaha
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial