Name
ASP Name 属性
Name 属性用于设置或返回指定文件或文件夹的名称。
语法
FileObject.Name[=newname]
FolderObject.Name[=newname]
FolderObject.Name[=newname]
参数 | 描述 |
---|---|
newname | 可选的。规定文件或文件夹的名称。 |
针对 File 对象的实例
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("The file‘s name: ")
Response.Write(f.Name)
set f=nothing
set fs=nothing
%>
输出:
The file‘s name: test.txt
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("The file‘s name: ")
Response.Write(f.Name)
set f=nothing
set fs=nothing
%>
输出:
The file‘s name: test.txt
针对 Folder 对象的实例
<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("The folder‘s name: ")
Response.Write(fo.Name)
set fo=nothing
set fs=nothing
%>
输出:
The folder‘s name: test
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("The folder‘s name: ")
Response.Write(fo.Name)
set fo=nothing
set fs=nothing
%>
输出:
The folder‘s name: test