ASP Path 属性
定义和用法
Path 属性用于返回指定驱动器、文件或文件夹的路径。
注意:对于驱动器,路径不包含根目录。例如,C 驱动器的路径是 C:,而不是 C:\。
语法:
DriveObject.PathFileObject.PathFolderObject.Path
针对 Drive 对象的例子
<%dim fs,dset fs=Server.CreateObject("Scripting.FileSystemObject")set d=fs.GetDrive("c:")Response.Write("路径是 " & d.Path)set d=nothingset fs=nothing%>
输出:
路径是 C:
针对 File 对象的例子
<%dim fs,fset fs=Server.CreateObject("Scripting.FileSystemObject")set f=fs.GetFile("c:\asp\test\test.asp")Response.Write("路径是: " & f.Path)set f=nothingset fs=nothing%>
输出:
路径是: C:\asp\test\test.asp
针对 Folder 对象的例子
<%dim fs,foset fs=Server.CreateObject("Scripting.FileSystemObject")set fo=fs.GetFolder("c:\asp\test")Response.Write("路径是: " & fo.Path)set fo=nothingset fs=nothing%>
输出:
路径是: C:\asp\test