O'Reilly logo

VBScript in a Nutshell, 2nd Edition by Ron Petrusha, Matt Childs, Paul Lomax

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

FileSystemObject.GetFileVersion Method

Syntax

                  oFileSysObj.GetFileVersion(FileName)
oFileSysObj

Use: Required

Data Type: FileSystemObject object

A reference to the FileSystemObject object.

FileName

Use: Required

Data Type: String

A path and filename.

Return Value

A String.

Description

Retrieves version information about the file specified in FileName.

Rules at a Glance

  • FileName should include the path as well as the name of the file. The path component can be either an absolute or a relative path to the file.

  • If path information is omitted, VBScript attempts to find FileName in the current folder.

  • This function reports version information in the format:

    Major_Version.Minor_Version.0.Build
  • If a file does not contain version information, the function returns an empty string (” “).

Programming Notes

  • The files that can contain version information are executable files (.exe) and dynamic link libraries (.dll).

  • If you’re using VBScript to replace a private executable or DLL with another, be particularly careful with version checking, since it has been a particularly serious source of error. Ensuring that the new version of the file should be installed requires that any one of the following conditions be true:

    • It has the same major and minor version but a later build number than the existing file.

    • It has the same major version but a greater minor version number than the existing file.

    • It has a higher version number than the existing file.

  • It’s also a good idea to copy the replaced file to a backup directory, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required