Hi Dan,
Thank you very much for your contribution. Special thanks for adding comments! I started working on my script using your code as a base. After 4 days, I've reached the 'form' that I need for my script. Now, I need you or other generous people's help to bring 'function'
1. I don't want current file to be shown as 'CurrentFolderCurrentFile'. Is there a way I can show only 'CurrentFile'?
2. I want the process to check if the filename contains KB* with a - before and after. For example, Windows6.1-KB2670838-x64.exe. It should check for KB2670838 in filename and otherwise skip that file even if it has MSU or EXE extension
3. I want a progress bar, if possible. Not necessary
4. status of the updates after they are run written to a file. errors to one file and success to another using success.datetime.txt and error.datetime.txt
#include <FileParts.au3>
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
; Scan Script Folder Recursively and Generate File List Array for files with extenstion MSU and EXE
$uFile = _FileListToArrayRec(@ScriptDir, "*.msu;*.exe", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT)
; Check if the Folder or File Actually Exist
If @error = 1 Then
MsgBox (48+1, "Error!", "Folder does not exist!", 0)
Exit
EndIf
If @error = 4 Then
MsgBox (48+1, "Error!", "Files don't exist!", 0)
Exit
EndIf
; Setup a general splash screen that will show the current update being installed
SplashTextOn("Installing Update...", "", 500, 100, -1, -1, 0, "", 14, 500)
; loop through the number of files from the array
For $u = 1 To $uFile[0]
;check for extension match
If StringRight($uFile[$u], 3) = "msu" Then
;rewrite splash screen with the current file being processed
ControlSetText ("Installing Update...", "", "Static1", $uFile[$u])
;Execute the selected file
RunWait(@SystemDir & "\wusa.exe " &@WorkingDir&"\"&$uFile[$u]& " /quiet /norestart")
ElseIf StringRight($uFile[$u], 3) = "exe" Then
ControlSetText ("Installing Update...", "", "Static1", $uFile[$u])
RunWait(@SystemDir & "\wusa.exe " &@WorkingDir&"\"&$uFile[$u]& " /q /norestart")
Else
ControlSetText ("Installing Update...", "", "Static1", $uFile[$u] & " is not a valid update!")
EndIf
Next
; switch off the splash screen
SplashOff()
Thank you.
with warm regards,
Shereef