Thuộc tính đường dẫn ASP


❮ Tham chiếu đối tượng thư mục hoàn chỉnh

Thuộc tính Path được sử dụng để trả về đường dẫn cho một ổ đĩa, tệp hoặc thư mục được chỉ định.


Cú pháp

DriveObject.Path

FileObject.Path

FolderObject.Path

Ví dụ cho đối tượng Drive

<%
dim fs,d
set fs=Server.CreateObject("Scripting.FileSystemObject")
set d=fs.GetDrive("c:")
Response.Write("The path is " & d.Path)
set d=nothing
set fs=nothing
%>

Output:

The path is C:

Ví dụ cho đối tượng Tệp

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\asp\test\test.asp")
Response.Write("The path is: " & f.Path)
set f=nothing
set fs=nothing
%>

Output:

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

Ví dụ cho đối tượng Thư mục

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\asp\test")
Response.Write("The path is: " & fo.Path)
set fo=nothing
set fs=nothing
%>

Output:

The path is: C:\asp\test

❮ Tham chiếu đối tượng thư mục hoàn chỉnh