Name
FileSystemObject.GetFileVersion Method
Syntax
oFileSysObj.GetFileVersion(FileName)
oFileSysObjUse: Required
Data Type: FileSystemObject object
A reference to the FileSystemObject object.
FileNameUse: 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
FileNameshould 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
FileNamein 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, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access