FileLocate

Finds file in current directory or along the DOS path.

Syntax:

FileLocate (filename)

Parameters:

(s) filename full file name, including extension.

Returns:

(s) fully-qualified path name.

 

This function is used to obtain the fully qualified path name of a file. The current directory is checked first, and if the file is not found, the DOS path is searched. The first occurrence of the file is returned.

Note:

64-bit : FileLocate on the WinBatch.exe always returns the file path of the 32-bit WinBatch.exe.  This is expected behavior because, FileLocate searches the process path first and since the 64-bit WinBatch.exe is not on the path, it always finds the 32-bit version. You can obtain the 64-bit WinBatch.exe file path from the registry.

Example:


; Edit WIN.INI
winini = FileLocate("win.ini")
If winini == ""
   Message("???", "WIN.INI not found")
Else
   DirChange(DirWindows(0))
   Run("notepad.exe", winini)
EndIf
See Also:

FileExist