Exist

File management function.

The Exist function checks for the existence of the specified file.

Usage

Before processing actions on a file, it is a good practise to test first if the file exists. You will not get an error if in some circumstances, the file does not exist.

Syntax

ret=Exist(<filename>)

Parameters

<filename>, string, name of the file to test. If no path is included in <filename>, the current directory is searched.

Return value

ret, numeric return code; if the file exists, the return code is set to 1, otherwise 0.

See also

ExistDir

Example

 

a=Exist(WinDir$()+"\sol.exe").

 

If a=1 then

' if sol.exe exists in Windows directory, run it.

shell("sol.exe")

endif