ASP Path 属性

定义和用法

Path 属性用于为指定的驱动器、文件或文件夹返回路径。

语法:

  1. DriveObject.Path
  2. FileObject.Path
  3. FolderObject.Path

针对 Drive 对象的例子

  1. <%
  2. dim fs,d
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set d=fs.GetDrive("e:")
  5. Response.Write("The path is " & d.Path)
  6. set d=nothing
  7. set fs=nothing
  8. %>

输出:

  1. The path is E:

针对 File 对象的例子

  1. <%
  2. dim fs,f
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set f=fs.GetFile("c:\asp\test.asp")
  5. Response.Write("The path is: " & f.Path)
  6. set f=nothing
  7. set fs=nothing
  8. %>

输出:

  1. The path is: C:\asp\test.asp

针对 Folder 对象的例子

  1. <%
  2. dim fs,fo
  3. set fs=Server.CreateObject("Scripting.FileSystemObject")
  4. set fo=fs.GetFolder("c:\asp\test")
  5. Response.Write("The path is: " & fo.Path)
  6. set fo=nothing
  7. set fs=nothing
  8. %>

输出:

  1. The path is: C:\asp\test