IfExist / IfNotExist


检查文件或文件夹的存在。

IfExist, FilePattern
IfNotExist, FilePattern
AttributeString := FileExist(FilePattern)

参数

FilePattern 要检查的路径、文件名或者文件类型。如果绝对路径没被指定, FilePattern 会被假设在 %A_WorkingDir%

相关命令

FileExist(), Blocks, Else, File-loops

范例

IfExist, D:\
    MsgBox, 驱动器存在。
IfExist, D:\Docs\*.txt
    MsgBox, 至少存在一个 .txt 文件。
IfNotExist, C:\Temp\FlagFile.txt
    MsgBox, 目标文件不存在。
翻译:天堂之门 menk33@163.com 2008年6月3日