使用该程序只需(相对本程序)在hotfix目录下放至所有补丁程序即可。
安装过程中会自动检测注册表跳过已安装的补丁程序,减少重复补丁的时间浪费。
发该源代码只为了新手入门学习,若程序存在各种缺陷待会员们修正并回帖共享!
源代码:
;---------------------------------------
#Include <File.au3>
Local Const $hklm="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HotFix"
;判断hotfix目录是否存在
If Not FileExists(@ScriptDir&"\hotfix") Then
DirCreate(@ScriptDir&"\hotfix")
MsgBox(64,"Error","未发现补丁程序,请将所有补丁程序拷贝至hotfix目录后在试!")
Exit
EndIf
ToolTip(@CR&"正在安装系统补丁,请稍后!"[email=&@CR,@DesktopWidth- 260,@DesktopHeight-120]&@CR,@DesktopWidth-260,@DesktopHeight-120[/email])
;读取已安装补丁
Local $i=1,$Exists=""
While 1
$Exists&=RegEnumKey($hklm,$i)
If @Error Then ExitLoop
$i+=1
WEnd
;打印列表并安装所有补丁
$i=1
Local $List=_FileListToArray(@ScriptDir&"\hotfix","*",1)
While $i<=$List[0]
$FixName=StringSplit($List[$i],"-")
$FixName=$FixName[2]
If Not StringInStr($Exists,$FixName) Then
RunWait(@ScriptDir&"\hotfix\"&$List[$i]&" /quiet /passive /norestart")
EndIf
$i+=1
WEnd
msgbox(64,"ok","Finish.")