• Welcome to Jose's Read Only Forum 2023.
 

IFolder.ShortPath Property

Started by José Roca, July 14, 2008, 12:33:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



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