Skip to content

Instantly share code, notes, and snippets.

@dorukcan
Last active April 20, 2016 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dorukcan/686ef78c3ac894fc66aed7cb2e30a6b2 to your computer and use it in GitHub Desktop.
Save dorukcan/686ef78c3ac894fc66aed7cb2e30a6b2 to your computer and use it in GitHub Desktop.
Runs windows update standalone files which have been downloaded by http://www.windowsupdatesdownloader.com/
#include <File.au3>
#RequireAdmin
Local $location = "C:\Users\dorukcan\Documents\Windows Updates Downloader\Non-Security Updates\"
Local $aFileList = _FileListToArray($location, "*")
For $i = 1 To $aFileList[0]
;open file
ShellExecute($location & $aFileList[$i])
ConsoleWrite($i & " " & $aFileList[$i] & @CRLF)
;click ok to install
Local $okWin = WinWait("[TITLE:Windows Update Standalone Installer; CLASS:#32770]")
WinActivate($okWin)
Local $text = ControlGetText($okWin, "", "Static1")
ControlClick($okWin, "", "Button1")
If StringInStr($text, "already") Then
ProcessWaitClose("wusa.exe")
ContinueLoop
EndIf
;wait for installation done and close the window
Local $insWin = WinWait("Download and Install Updates", "Installation complete")
WinActivate($insWin)
ControlClick($insWin, "", "Button4")
;be sure about the previous process has been closed
ProcessWaitClose("wusa.exe")
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment