dirlist() did the job...
Code:
break on
;************************************ W2K HotFix Updates *****************************************
;Go c:
?""
?""
If @producttype="Windows 2000 Server"
$setup='\\server\srvpatch$'
$arrkey = arrEnumKey('HKLM\SOFTWARE\Microsoft\Updates\Windows 2000\SP5')
$arrdir = arrEnumDir($setup+'\w2k_hotfixes','*.exe',1)
$reboot = 0
For Each $Dir in $arrdir
$installed = 0
$parsed = Split($Dir,'-')[1]
For Each $key in $arrkey
If $key = $parsed
$installed = 1
EndIf
Next
If NOT $installed
$=SendMessage(@wksta,"A CRTICAL upgrade is now starting. Your computer will restart on it's own in about 2-3 minutes. Please do not open any programs. There is no need to click the OK button.")
? ' Installing '+$parsed
Shell '%comspec% /c ' + $Dir + ' -z -u -o' ; -q -n
;$ = WriteProfileString($logon+'\inventory\HotFix.log', $parsed, @wksta, @date)
$reboot = 1
EndIf
Next
If $reboot
Shutdown ('', 'Updates have been applied that require to computer to restart', 5, 1, 1)
Quit
EndIf
EndIf
;****************************************************************************************************
Function WshPipe($ShellCMD, OPTIONAL $NoEcho)
Dim $oExec, $Output
$oExec = CreateObject("WScript.Shell").Exec($ShellCMD)
If NOT VarType($oExec)=9 $WshPipe="WScript.Shell Exec Unsupported" Exit 10 EndIf
While NOT $oExec.Status Loop
$Output = $oExec.StdOut.ReadAll + $oExec.StdErr.ReadAll
If NOT $NoEcho $Output EndIf
$WshPipe=Split($Output,Chr(10))
Exit($oExec.ExitCode)
EndFunction
;****************************************************************************************************
;FUNCTION DirList
;
;AUTHOR Jens Meyer (sealeopard@usa.net)
;
;ACTION Returns an array with a list of files in a given directory
;
;VERSION 1.2
;
;KIXTART 4.12
;
;SYNTAX DIRLIST(DIRNAME [,OPTIONS])
;
;PARAMETERS DIRNAME
; Required string containing the directory name
;
; OPTIONS
; Optional value for additional options, options are set bitwise
; 1 = include directories (denoted by a backslash) that match the search mask
; 2 = include full path
; 4 = search all subdirectories
;
;RETURNS array with a list of files, otherwise an empty string
;
;REMARKS none
;
;DEPENDENCIES none
;
;EXAMPLE $dirlist = DIRLIST("c:\*.*",1+2+4)
;
;KIXTART BBS http://www.kixtart.org/cgi-bin/ultimatebb.cgi?ubb=get_topic&f=12&t=000090
;
Function dirlist($dirname, optional $options)
Dim $filename, $counter, $filepath, $mask
Dim $list, $sublist, $subcounter
$counter=-1
$dirname=Trim($dirname)
If $dirname=''
$dirname=@CURDIR
EndIf
If Right($dirname,1)='\'
$dirname=Left($dirname,Len($dirname)-1)
EndIf
If GetFileAttr($dirname) & 16
$mask='*.*'
Else
$mask=SubStr($dirname,InStrRev($dirname,'\')+1)
$dirname=Left($dirname,Len($dirname)-Len($mask)-1)
EndIf
ReDim $list[10]
$filename=Dir($dirname+'\'+$mask)
While $filename<>'' AND @ERROR=0
If $filename<>'.' AND $filename<>'..'
Select
Case (GetFileAttr($dirname+'\'+$filename) & 16)
If $options & 1
$counter=$counter+1
If $options & 2
$list[$counter]=$dirname+'\'+$filename+'\'
Else
$list[$counter]=$filename+'\'
EndIf
EndIf
If ($options & 4)
$sublist=dirlist($dirname+'\'+$filename+'\'+$mask,4)
If Ubound($sublist)+1
ReDim preserve $list[Ubound($list)+Ubound($sublist)+1]
For $subcounter=0 to Ubound($sublist)
$counter=$counter+1
If $options & 2
$list[$counter]=$dirname+'\'+$filename+'\'+$sublist[$subcounter]
Else
$list[$counter]=$filename+'\'+$sublist[$subcounter]
EndIf
Next
EndIf
EndIf
Case ($options & 2)
$counter=$counter+1
$list[$counter]=$dirname+'\'+$filename
Case 1
$counter=$counter+1
$list[$counter]=$filename
EndSelect
If $counter mod 10
ReDim preserve $list[$counter+10]
EndIf
EndIf
$filename = Dir('')
Loop
If $counter+1
ReDim preserve $list[$counter]
Else
$list=''
EndIf
If $mask<>'*.*' AND ($options & 4)
$filename=Dir($dirname+'\*.*')
While $filename<>'' AND @ERROR=0
If $filename<>'.' AND $filename<>'..'
If (GetFileAttr($dirname+'\'+$filename) & 16)
$sublist=dirlist($dirname+'\'+$filename+'\'+$mask,4)
If Ubound($sublist)+1
ReDim preserve $list[Ubound($list)+Ubound($sublist)+1]
For $subcounter=0 to Ubound($sublist)
$counter=$counter+1
If $options & 2
$list[$counter]=$dirname+'\'+$filename+'\'+$sublist[$subcounter]
Else
$list[$counter]=$filename+'\'+$sublist[$subcounter]
EndIf
Next
EndIf
EndIf
EndIf
$filename = Dir('')
Loop
EndIf
If $counter+1
ReDim preserve $list[$counter]
Else
$list=''
EndIf
$dirlist=$list
EndFunction