Checks if a file or directory exists.
FileExists ( "path" )
FileExists() returns 0 if you specify a floppy drive which does not contain a disk.
If you are running in X86 mode (@AutoItX64 = 0) under a Windows running in X64 mode (@OSArch = "X64") and you want to access @WindowsDir\System32, X64 files will not be found. So you can use @WindowsDir\Sysnative.
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
Example()
Func Example()
; Create a constant variable in Local scope of the filepath that will be read/written to.
Local Const $sFilePath= _WinAPI_GetTempFileName (@TempDir )
Local $iFileExists= FileExists ($sFilePath)
; Display a message of whether the file exists or not.
If $iFileExistsThen
MsgBox ($MB_SYSTEMMODAL,"","The file exists."&@CRLF &"FileExist returned: "&$iFileExists)
Else
MsgBox ($MB_SYSTEMMODAL,"","The file doesn't exist."&@CRLF &"FileExist returned: "&$iFileExists)
EndIf
; Delete the temporary file.
FileDelete ($sFilePath)
EndFunc ;==>Example