Thuộc tính ShortPath của ASP
Định nghĩa và cách sử dụng
Thuộc tính ShortPath được sử dụng để trả về đường dẫn ngắn của tệp hoặc thư mục cụ thể (8.3约定 tên tệp).
Cú pháp:
FileObject.ShortPath FolderObject.ShortPath
Ví dụ về đối tượng File
<% dim fs,f set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("c:\asp_test_web\hitcounterfile.txt") Response.Write("Đường dẫn: " & f.Path) Response.Write("<br />ShortPath: " & f.ShortPath) set f=nothing set fs=nothing %>
Kết quả xuất ra:
Path: C:\asp_test_web\hitcounterfile.txt ShortPath: C:\ASP_TE~1\HITCOU~1.TXT
Ví dụ về đối tượng Folder
<% dim fs,fo set fs=Server.CreateObject("Scripting.FileSystemObject") set fo=fs.GetFolder("c:\asp_test_web") Response.Write("Đường dẫn: " & fo.Path) Response.Write("<br />ShortPath: " & fo.ShortPath) set fo=nothing set fs=nothing %>
Kết quả xuất ra:
Path: C:\asp_test_web ShortPath: C:\ASP_TE~1