Name 属性用于设置或返回指定文件或文件夹的名称。
FileObject.Name[=newname]
FolderObject.Name[=newname]
参数 | 描述 |
---|---|
newname | 可选的。规定文件或文件夹的名称。 |
<%
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,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