Visual Basic Scripting Edition | 語言參考 |
返回文件或文件夾的類型信息。例如,對于擴展名為 .TXT 的文件,返回“Text Document”。
object.Type
object 應為 File 或 Folder 對象的名稱。
以下代碼舉例說明如何使用 Type 屬性返回文件夾的類型。在此示例中,試圖向過程提供“回收站”或其他唯一文件夾的路徑。
Function ShowFolderType(filespec) Dim fso, f, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(filespec) s = UCase(f.Name) & "
的類型為" & f.Type
End Function
ShowFolderType = s
Attributes 屬性 | DateCreated 屬性 | DateLastAccessed 屬性 | DateLastModified 屬性 | Drive 屬性 | Files 屬性 | IsRootFolder 屬性 | Name 屬性 | ParentFolder 屬性 | Path 屬性 | ShortName 屬性 | ShortPath 屬性 | Size 屬性 | SubFolders 屬性