基 础 函 数 参 考


FileExists

检查文件或目录是否存在.

FileExists ( "路径" )

参 数

路径 文件或目录的路径.

返 回 值

成功: 返回 1.
失败: 返回 0, 指定路径/文件不存在.

备 注

如果指定软驱未插入磁盘, 则 FileExists 返回 0.

相 关 函 数

FileGetAttrib, DriveStatus

函 数 示 例


If FileExists("C:\autoexec.bat") Then
    MsgBox(4096, "C:\autoexec.bat 文件", "存在")
Else
    MsgBox(4096, "C:\autoexec.bat 文件", "不存在")
EndIf

If FileExists("C:\") Then
    MsgBox(4096, "C:\ Dir ", "存在")
Else
    MsgBox(4096, "C:\ Dir", "不存在")
EndIf

If FileExists("D:") Then
    MsgBox(4096, "驱动器 D:", "存在")
Else
    MsgBox(4096, "驱动器 D:", "不存在")
EndIf

provider with jb51.net (unicode)