Name
FileSystemObject.GetFileVersion Method
Syntax
oFileSysObj
.GetFileVersion(FileName
)
-
oFileSysObj
Use: Required
Data Subtype: FileSystemObject object
A reference to the FileSystemObject object.
-
FileName
Use: Required
Data Subtype: String
A path and filename.
Return Value
A variant of subtype 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 a null 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 ...
Get VBScript in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.