Reference/FindFirst: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
mNo edit summary
Line 13: Line 13:
done:
done:
FindClose $0</highlight-nsis>
FindClose $0</highlight-nsis>
''Command introduced with NSIS v1.60''

Revision as of 20:33, 4 June 2013

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 FindNext 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

Command introduced with NSIS v1.60