VBS tutorial: attribute – type attribute

Time:2022-5-1

Type attribute

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

object.Type

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

explain

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