设置或返回指定文件或文件夹的名称。读/写。
object.Name [= newname]
下面的代码说明了 Name 属性的用法:
[JScript] function ShowFileAccessInfo(filespec) { var fso, f, s; fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.GetFile(filespec); s =f.Name
+ " on Drive " + f.Drive + "<br>"; s += "Created:" + f.DateCreated + "<br>"; s += "Last Accessed:" + f.DateLastAccessed + "<br>"; s += "Last Modified:" + f.DateLastModified; return(s); } [VBScript] Function ShowFileAccessInfo(filespec) Dim fso, f, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFile(filespec) s =f.Name
& " on Drive " & UCase(f.Drive) & "<BR>" s = s & "Created:" & f.DateCreated & "<BR>" s = s & "Last Accessed:" & f.DateLastAccessed & "<BR>" s = s & "Last Modified:" & f.DateLastModified ShowFileAccessInfo = s End Function
Attributes 属性 | DateCreated 属性 | DateLastAccessed 属性 | DateLastModified 属性 | Drive 属性 | Files 属性 | IsRootFolder 属性 | ParentFolder 属性 | Path 属性 | ShortName 属性 | ShortPath 属性 | Size 属性 | SubFolders 属性 | Type 属性