IfExist / IfNotExist

AutoHotKey

IfExist / IfNotExist

检查文件或文件夹是否存在.

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

参数

FilePattern

需检查的路径, 文件名或文件模式. 如果未指定绝对路径则假定 FilePattern%A_WorkingDir% 中.

相关

FileExist(), 区块, Else, 文件循环

示例

IfExist, D:\
    MsgBox, The drive exists.
IfExist, D:\Docs\*.txt
    MsgBox, At least one .txt file exists.
IfNotExist, C:\Temp\FlagFile.txt
    MsgBox, The target file does not exist.