如果指定的文件夾存在則返回 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 方法
應(yīng)用于:FileSystemObject 對(duì)象