IF Locate(file name, drive/dir) searches the user's system for a specific file. It searches all directories on some or all drives. If the function does not find the specified file, it assigns a value of false. Otherwise, it assigns the value of true and files the \$LocateDir\$ value with the file path. The file name parameter is the name of the file to be searched for and the optional drive/dir parameter (you can type in any drive letter or directory name) is used to limit the search to a specific drive or directory. The optional local parameter limits the search to all local drives, and the optional network parameter limits the search to all network drives. Note that CD-ROM drives are treated as local or network drives and are searched, which may be a slow process.

For example:

IF LOCATE("zipcode.exe", c)

DEFAULTDIR: "\$LOCATEDIR\$"

ELSE

DEFAULTDIR: "c:\zipcode"

ENDIF

This example searches the C drive on the user's system for the file,Zipcode.exe. If found, the suggested installation directory is set to the directory containing Zipcode.exe. If it isn't found, the suggested installation directory is set to C:\Zipcode.