From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Get File Version Information for EXE’s and DLL’s

Code and Documents

Attachment

Summary:

This VI uses the ActiveX FileSystemObject that is part of the Microsoft scripting host to gather file version information for exe’s and dll’s.  The VI returns the version information in a variety of forms for parsing in an application.

Function:

The VI takes a filespec (path + filename) to a file for which you want the version info.  It returns the following:

  • Full version = the result from calling GetFileVersion.  Usually of the form “1.2.3.4”
  • No build verion = “1.2.3”.  I usually use a <major>.<minor>.<bugfix> nomenclature for my builds.
  • Version array = an array of 1, 2, 3, 4.  Useful for custom parsing.

Steps to execute code:

  1. Drop a copy of the VI on your block diagram.
  2. Wire a path to a file into Filespec.
  3. Inspect the returned version results and enjoy!

Screenshots:

GetFileVerion (ActiveX) screenshot.png

VI Snippet:

GetFileVerion (ActiveX) snippet.png

VI attached below

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
Fox_Mccloud
Member
Member
on

Hi!

Looks nice!

I've been using the vi ..\National Instruments\LabVIEW 2009\vi.lib\Platform\fileVersionInfo.llb\FileVersionInfo.vi to accomplish the same thing. Take a look at it. I found it very useful!


Cheers!

10Degree
Active Participant
Active Participant
on

Thanks for the pointer to that!  Do you have a method to crowbar the lpData into the FileVersionInformation.ctl? I should spend some time and dig through those llb's...

ChristianEckl
Member
Member
on

Thanks a lot for this hint. In my opinion this implementation is better as this one her:https://forums.ni.com/t5/LabVIEW/File-version-info/m-p/361945?jump=true

It doesn't use the .NET Runtime which have to be installed on some operation systems.

Thanks a lot.

Contributors