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, 12:33:35 AM

Title: IFolder.ShortPath Property
Post by: José Roca on July 14, 2008, 12:33:35 AM


The following code illustrates the use of the ShortPath property with a File object:

JScript


function ShowShortPath(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = "The short path for " + "" + f.Name;
   s += "" + "<br>";
   s += "is: " + "" + f.ShortPath + "";
   return(s);
}


VBScript


Function ShowShortPath(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = "The short path for "   & UCase(f.Name) & "<BR>"
   s = s & "is: " & f.ShortPath
   ShowShortPath = s
End Function


PowerBASIC


FUNCTION ShowShortPath (BYVAL filespec AS STRING) AS STRING

   LOCAL fso AS IFileSystem
   LOCAL f AS IFile
   LOCAL s AS STRING
   
   fso = NEWCOM "Scripting.FileSystemObject"
   f = fso.GetFile(UCODE$(filespec))
   s = "The short path for "   & ACODE$(f.Name) & $CRLF
   s = s & "is: " & ACODE$(f.ShortPath)
   FUNCTION = s

END FUNCTION