Reference/FindFirst: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Created page with "=FindFirst= user_var(handle output) user_var(filename output) filespec Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It ...")
 
Line 3: Line 3:
  user_var(handle output) user_var(filename output) filespec
  user_var(handle output) user_var(filename output) filespec


Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with [[Reference/FileNext|FileNext]]and [[Reference/FileClose|FileClose]]. Note that the filename output is without path.
Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with [[Reference/FileNext|FileNext]] and [[Reference/FileClose|FileClose]]. Note that the filename output is without path.


<highlight-nsis>FindFirst $0 $1 $INSTDIR\*.txt
<highlight-nsis>FindFirst $0 $1 $INSTDIR\*.txt

Revision as of 20:22, 27 November 2011

FindFirst

user_var(handle output) user_var(filename output) filespec

Performs a search for 'filespec', placing the first file found in filename_output (a user variable). It also puts the handle of the search into handle_output (also a user variable). If no files are found, both outputs are set to empty, and the error flag is set. Best used with FileNext and FileClose. Note that the filename output is without path.

FindFirst $0 $1 $INSTDIR\*.txt
loop:
  StrCmp $1 "" done
  DetailPrint $1
  FindNext $0 $1
  Goto loop
done:
FindClose $0