找回密码
 加入
搜索
查看: 3984|回复: 1

[系统综合] 补丁批量更新程序

[复制链接]
发表于 2014-5-19 18:55:31 | 显示全部楼层 |阅读模式
怎么批量安装Hotfix\.Net\*.exe 、Hotfix\Important\*.msu、Hotfix\Optional\*.msu  ;
msu安装参数 /quiet /norestart ,exe安装参数 /q /norestart,而且加上进度条
#include <File.au3>
$FileList = _FileListToArray(@ScriptDir & "\Hotfix", "*.exe", 1)
If @error = 1 Then
        MsgBox(0, '', '没有找到文件夹,点击确定后自动创建')
        DirCreate(@ScriptDir & '\Hotfix')
        Exit
EndIf
If @error = 4 Then
        MsgBox(0, '', '错误 文件夹中没有文件,清将补丁文件放入Hotfix文件夹')
        Exit
EndIf
For $i = 3 To 1 Step -1
        ToolTip(@CR & "  共" & $FileList[0] & "个系统补丁," & $i & "秒后开始安装...   " & @CR, @DesktopWidth - 260, @DesktopHeight - 100)
        Sleep(1000)
Next
For $i = 1 To $FileList[0]
        ToolTip(@CR & "  正在安装 " & $FileList[$i] & " (" & $i & "/" & $FileList[0] & ")   " & @CR, @DesktopWidth - 320, @DesktopHeight - 100)
        RunWait(@ScriptDir & "\Hotfix" & $FileList[$i] & " /quiet /passive /norestart")
Next
ToolTip(@CR & "  系 统 补 丁 安 装 完 毕 !  " & @CR, @DesktopWidth - 260, @DesktopHeight - 100)
Sleep(2000)
进度条代码:
#include <ComboConstants.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>

$Form1 = GUICreate("进度条", 380, 200)
$Progress1 = GUICtrlCreateProgress(50, 50, 260, 30)
$Button1 = GUICtrlCreateButton("开始", 150, 150, 80, 30, $WS_GROUP)
$Button2 = GUICtrlCreateButton("退出", 240, 150, 80, 30, $WS_GROUP)
$Combo1 = GUICtrlCreateCombo("1", 210, 100, 80, 50)
GUICtrlSetData(-1, "1|2|3|4|5|6|7|8|9|10|", "1")
$Label1 = GUICtrlCreateLabel("选择安装软件的数量:", 50, 100, 160, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("0%", 320, 53, 50, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case -3,$Button2
                        Exit
                Case $Button1
                        kaishi()
        EndSwitch
WEnd

Func kaishi()
        $a = GUICtrlRead($Combo1)
        $b = Int (100 / $a)
        $z = 1
        For $i = 1 To 100
                GUICtrlSetData($Progress1,$i)
                GUICtrlSetData($Label2,$i&"%")
                $c = GUICtrlRead($Progress1)
                $d = IsInt($c / $b )
                If $d = 1 Then 
                        MsgBox(0,"","已经安装"&$z&"个软件")
                        $z += 1
                EndIf        
        Next        
EndFunc
大神帮下忙,合并一下,谢谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-5-16 06:33 , Processed in 0.078200 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表