本帖最后由 令狐大虾 于 2025-4-24 00:01 编辑 <div class="blockcode"><blockquote>#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
; 创建GUI窗口
Local $hGUI = GUICreate("WIM释放工具", 400, 150)
Local $idProgress = GUICtrlCreateProgress(20, 20, 360, 30)
Local $idLabel = GUICtrlCreateLabel("准备中...", 20, 70, 360, 20)
GUISetState(@SW_SHOW)
; 定义wimlib命令参数
Local $sWimFile = "64w7.wim" ; WIM文件路径
Local $sTargetDir = "D:\Extracted" ; 释放目标目录
Local $sWimlibPath = @ScriptDir & "\wimlib-imagex.exe" ; 工具路径
; 启动命令行进程(隐藏窗口)
Local $iPID = Run($sWimlibPath & ' apply "' & $sWimFile & '" 1 "' & $sTargetDir & '"', "", @SW_HIDE)
While 1
; 读取实时输出
Local $sOutput = StdoutRead($iPID)
If @error Then ExitLoop
; 解析进度百分比(示例输出行:"Progress: 50.00%")
If StringRegExp($sOutput, "Progress:\s*(\d+\.\d+)%") Then
Local $aMatches = StringRegExp($sOutput, "(\d+\.\d+)", 1)
If Not @error Then
GUICtrlSetData($idProgress, $aMatches[0])
GUICtrlSetData($idLabel, "进度: " & $aMatches[0] & "%")
EndIf
EndIf
Sleep(100)
WEnd
; 检查执行结果
If ProcessWaitClose($iPID, 0) = 0 Then
MsgBox(64, "成功", "WIM文件已成功释放")
EndIf
进度条不出现0%到100%提示
|