Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
File versions that are incompatible or out-of-date can create considerable problems for system administrators. For example, a script that runs fine on Computer A, where version 2.0 of a particular DLL has been installed, might fail on Computer B, which has version 1.0 of that DLL installed.
These problems can be difficult to troubleshoot, because you are likely to get back an error saying that the object does not support a particular property or method. This is because the version of the object installed on Computer B does not support the new property or method. If you try to debug the script on Computer A, you will have difficulty finding the problem because the version of the object installed on Computer A does support the property or method in question.
The GetFileVersion method allows you to retrieve version information from a file. To use this method, a script must:
For example, the script in Listing 4.31 retrieves the file version for Scrrun.dll.
Listing 4.31 Retrieving File Versions
|
|
When this script runs on a Windows 2000-based computer with WSH 5.6 installed, the message box shown in Figure 4.7 appears.
Figure 4.7 Version Number for Scrrun.dll
Version Number for Scrrun.dll
Version numbers are typically displayed in four parts, such as 5.6.0.6626, rather than a single number (such as version 1 or version 5). Version number 5.6.0.6626 contains the following parts:
Not all files types support versioning. Executable files and DLLs typically support versioning; plain-text files, including scripts, typically do not.
Send us your feedback | « Previous | Next » |