From: Jan Svitok Date: 2006-10-04T00:17:38+09:00 Subject: Re: Finding the file version of a win32 dll in Ruby On 10/3/06, Phil Wilson wrote: > Is there a way to determine the file version attribute in win32 using Ruby? > I would like to report and compare file versions between 2 different windows > computers using Ruby. I am mainly concerned with dll, ocx and exe file > types. > > Thanks for any help. > Phil I use filever.exe (download from [1] and/or win xp sp2 cd) and this: module Win class Version class << self # returns version as array i.e. [1, 2, 12312, 5] or # empty array def get_version_array(path) (get_version(path) || '').split('.').collect {|i| i.to_i} end # return version as string ('1.2.12312.5') or nil def get_version(path) ver = short(path) ver.empty? ? nil : ver[14..30].strip end def short(path) `filever /B /A "#{Path.to_win(path)}" 2>&1` end def full(path) `filever.exe /V "#{Path.to_win(path)}" 2>&1` end end end end [1] http://www.microsoft.com/downloads/details.aspx?FamilyId=49AE8576-9BB9-4126-9761-BA8011FABF38&displaylang=en