SEARCHPATH$ function

Purpose: SEARCHPATH$ searches for a file and, if successful, returns a string containing the path to the first found instance of the file sought. The search is conducted in the following sequence:

  1. The folder from which the application loaded.
  2. The current folder.
  3. Windows 95: The Windows system folder. Use the BCX SYSDIR$ function to get the path of this folder.
  4. Windows NT: The 32-bit Windows system folder. Use the BCX SYSDIR$ function to get the path of this folder. The name of this folder is SYSTEM32.
  5. Windows NT: The 16-bit Windows system folder. There is no Win32 function that obtains the path of this folder, but it is searched. The name of this folder is SYSTEM.
  6. The Windows folder. Use the BCX WINDIR$ function to get the path of this folder.
  7. The directories that are listed in the PATH environment variable.

 Syntax:

 RetStr$ = SEARCHPATH$(FileName$)

 Parameters:

  • RetStr$ returns, if successful, a string containing the path to the first found instance of the file sought. If the function is unsuccessful, in the search, then 0 (zero) is returned.
  • FileName$ A string specifying the name of the file for which to search.