Thuộc tính tên ngắn ASP


❮ Toàn bộ tham chiếu đối tượng thư mục

Thuộc tính ShortName được sử dụng để trả về tên ngắn của một tệp hoặc thư mục cụ thể (quy ước đặt tên 8.3).


Cú pháp

FileObject.ShortName

FolderObject.ShortName

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

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\hitcounterfile.txt"))
Response.Write("Name: " & f.Name)
Response.Write("<br>ShortName: " & f.ShortName)
set f=nothing
set fs=nothing
%>

Output:

Name: hitcounterfile.txt
ShortName: HITCOU~1.TXT

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_web")
Response.Write("Name: " & fo.Name)
Response.Write("<br>ShortName: " & fo.ShortName)
set fo=nothing
set fs=nothing
%>

Output:

Name: asp_test_web
ShortName: ASP_TE~1

❮ Toàn bộ tham chiếu đối tượng thư mục