คุณสมบัติ Path ของ ASP
คำนำออกและใช้งาน
คุณสมบัติ Path ใช้เพื่อคืนค่าทางของไดรฟ์ ไฟล์ หรือ ระยะทางของไฟล์
หมายเหตุ:สำหรับไดรฟ์ ระยะทางไม่มีไดเรกทอรีเชิงมุมเริ่มต้น ตัวอย่าง ระยะทางของไดรฟ์ C คือ C: ไม่ใช่ C:\
บทความ
DriveObject.Path FileObject.Path FolderObject.Path
ตัวอย่าง
เพื่อตัวแปล 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 %>
ออกมาด้วย:
The path is C:
เพื่อตัวแปล File
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("d:\asp\test\test.asp") Response.Write("The path is: " & f.Path) set f=nothing set fs=nothing %>
ออกมาด้วย:
The path is: D:\asp\test\test.asp
เพื่อตัวแปล Folder
<% dim fs,fo set fs=Server.CreateObject("Scripting.FileSystemObject") set fo=fs.GetFolder("d:\asp\test") Response.Write("The path is: " & fo.Path) set fo=nothing set fs=nothing %>
ออกมาด้วย:
ทางที่ไปด้วย: D:\asp\test