VBS tutorial: attribute – type attribute


Type attribute

Returns the type information of a file or folder. For example, for an extension of “Text, return document”.


Object should be the name of a file or folder object.


The following code illustrates how to useTypeProperty returns the type of folder. In this example, an attempt is made to provide the process with a path to the recycle bin or other unique folder.

Function ShowFolderType(filespec)    Dim fso, f, s    Set fso = CreateObject("Scripting.FileSystemObject")    Set f = fso. Getfolder (filespec) s = ucase (f.name) & "type is" & f.type end functionshowfoldertype = s