$fexist function
$fexist(path)
The $fexist function checks if the file or folder specified by path
exists and returns a value < 0, 0, or > 0 depending on the result:
| Path status |
Result |
| path exists and is a folder |
< 0 |
| path does not exist |
0 |
| path exists and is a file |
> 0 |
The result can be used in conditional expressions;
see Examples below.
Windows Installer does not support symbolic functions; if you use this function
during an MSI build, you will get diagnostic message BLD:U0010
and the result is undefined.
Parameters
All parameters may contain symbolic references; these are resolved before the
function is applied. See Examples below.
- path
- Path of the file or folder whose existence must be checked. path
may contain wildcards.
Examples
Here are some usage examples for this function:
- <$fexist(<WindowsFolder>\Notepad.exe)>
- Returns > 0 if the Notepad.exe file exists; 0 if it does not;
and < 0 if it is a folder (which is highly unlikely).
- <$fexist(<TempFolder>\*.log)>
<$fexist(<TempFolder>\*.log)> <> 0
<$fexist(<TempFolder>\*.log)> > 0
- All conditional expressions evaluate to TRUE if any .log files
exist in the user's Temp folder. The first two also evaluate to
TRUE if a .log folder exists; the third expression only evaluates
to TRUE for proper files.
- NOT <$fexist(<TempFolder>\*.log)>
- Conditional expression that evaluates to TRUE if no .log files
or folders exist in the user's Temp folder.