|
怎么批量安装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
大神帮下忙,合并一下,谢谢 |
|