procedure FileSearch(var Files: TStringList; Path: String; Mask: String = '*');
var
S: String;
begin
for S in TDirectory.GetFiles(Path, Mask, TSearchOption.soAllDirectories) do
Files.Add(S);
end;
var
slist : TStringList;
begin
slist := TStringList.Create;
FileSearch(slist, 'D:\Temp', '*.bat');
ShowMessage(slist.Text);