本人初学者,经供记忆,可参考官网实例
${Locate} "$INSTDIR" "/M=OEM" "FolderPro"
Function FolderPro
${If} $R9 != ""
SetFileAttributes "$R7" FILE_ATTRIBUTE_HIDDEN
Push "LocateNext"
${Else}
Push "StopLocate"
${EndIf}
FunctionEnd
官网地址:https://nsis.sourceforge.io/Locate
官网帮助:
${Locate} "[Path]" "[Options]" "Function"
"[Path]" ; Disk or Directory
;
"[Options]" ; /L=[FD|F|D|DE|FDE]
; /L=FD - Locate Files and Directories (default)
; /L=F - Locate Files only
; /L=D - Locate Directories only
; /L=DE - Locate Empty Directories only
; /L=FDE - Locate Files and Empty Directories
; /M=[mask]
; /M=*.* - Locate all (default)
; /M=*.doc - Locate Work.doc, 1.doc ...
; /M=Pho* - Locate PHOTOS, phone.txt ...
; /M=win???.exe - Locate winamp.exe, winver.exe ...
; /M=winamp.exe - Locate winamp.exe only
; /S=No:No[B|K|M|G]
; /S= - Don‘t locate file size (faster) (default)
; /S=0:0B - Locate only files of 0 Bytes exactly
; /S=5:9K - Locate only files of 5 to 9 Kilobytes
; /S=:10M - Locate only files of 10 Megabyte or less
; /S=1G - Locate only files of 1 Gigabyte or more
; /G=[1|0]
; /G=1 - Locate with subdirectories (default)
; /G=0 - Locate without subdirectories
; /B=[0|1]
; /B=0 - Banner isn‘t used (default)
; /B=1 - Banner is used. Callback when function
; start to search in new directory
"Function" ; Callback function when found
Function "Function"
; $R9 "path\name"
; $R8 "path"
; $R7 "name"
; $R6 "size" ($R6="" if directory, $R6="0" if file with /S=)
; $R0-$R5 are not used (save data in them).
; ...
Push $var ; If $var="StopLocate" Then exit from function
FunctionEnd
原文:https://www.cnblogs.com/xubaonxopen/p/14722947.html