Drive 属性用于返回指定的文件或文件夹所处的驱动器的驱动器字母(驱动器号)。
FileObject.Drive FolderObject.Drive
<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("d:\test.txt")
Response.Write("File resides on drive: ")
Response.Write(f.Drive
)
set f=nothing
set fs=nothing
%>
输出:
File resides on drive: d:
<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("d:\test")
Response.Write("Folder resides on drive: ")
Response.Write(fo.Drive
)
set fo=nothing
set fs=nothing
%>
输出:
Folder resides on drive: d: