如果指定的文件夹存在则返回 True ;否则返回 False。
object.FolderExists(folderspec)
下面的例子说明了 FileExists 方法的用法。
[JScript] function ReportFolderStatus(fldr) { var fso, s = fldr; fso = new ActiveXObject("Scripting.FileSystemObject"); if (fso.FolderExists(fldr)) s += " exists."; else s += " doesn't exist."; return(s); } [VBScript] Function ReportFolderStatus(fldr) Dim fso, msg Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FolderExists(fldr)) Then msg = fldr & " exists." Else msg = fldr & " doesn't exist." End If ReportFolderStatus = msg End Function
DriveExists 方法 | FileExists 方法 | GetFolder 方法 | GetParentFolderName 方法
应用于:FileSystemObject 对象