Skip to content
⌘ NSIS Forum Archive

how to search a file

7 posts

derida#

how to search a file

hi,
how to search for a specified file ? and then add the filepath to $instdir ?

thanks 4 help
Davion#
Look in the Helpfile

4.9.3.11 SearchPath
user_var(output) filename

Assign to the user variable $x, the full path of the file named by the second parameter. The error flag will be set and $x will be empty if the file cannot be found. Uses SearchPath() to search the system paths for the file.

a example:

if you search for notepad, you need this line:
SearchPath $1 notepad.exe

after this $1 will contain the path of notepad

I hope this helps

greetz Dave
Afrow UK#
So this basically performs the Windows search api?
Does that mean that the search functions on the archive are practically now redundant?

-Stu
kichik#
SearchPath searches through a very specific list of folders. The functions from the Archive allow you to choose which folders to search.
kichik#
Actually, it's:
  1. $EXEDIR
  2. current working directory ($OUTPATH if SetOutPath was used)
  3. $SYSDIR
  4. 16-bit system directory
  5. $WINDIR
  6. Directories listed in the PATH environment variable