PowerBasic Museum 2020-A

Legacy Software (PBWIN 9.0+/PBCC 5.0+) => Windows Script Runtime => Source Code => Scripting => FileSystemObject => Topic started by: José Roca on July 14, 2008, 02:11:33 AM

Title: IFileSystem3.GetFileVersion Method
Post by: José Roca on July 14, 2008, 02:11:33 AM


The following example illustrates the use of the GetFileVersion method.

JScript


function GetVersion(drivespec){
   var fso, s = "";
   fso = new ActiveXObject("Scripting.FileSystemObject");
   s += fso.GetFileVersion(drivespec);
   return(s);
}


VBScript


Function GetVersion(DriveSpec)
   Dim fso, temp
   Set fso = CreateObject("Scripting.FileSystemObject")
   temp = fso.GetFileVersion(DriveSpec)
   If Len(temp) Then
      GetVersion = temp
   Else
      GetVersion = "No version information available."
   End If
End Function


PowerBASIC


FUNCTION GetVersion (BYVAL DriveSpec AS STRING) AS STRING

   LOCAL fso AS IFileSystem3
   LOCAL temp AS STRING
   
   fso = NEWCOM "Scripting.FileSystemObject"
   temp = ACODE$(fso.GetFileVersion(UCODE$(DriveSpec)))
   IF LEN(temp) THEN
      FUNCTION = temp
   ELSE
      FUNCTION = "No version information available."
   END IF

END FUNCTION