|
是AU3写的,一开始我就猜到了,呵呵~我把代码转过来:
- #AutoIt3Wrapper_Icon=windows7.ico
- #AutoIt3Wrapper_Res_Fileversion=0.9.0.0
- #cs ____________________________________
- Au3 版本:0.9.0.0
- 脚本作者: republican
- #ce _______________脚本开始_________________
- #include <ButtonConstants.au3>
- #include <GUIConstantsEx.au3>
- #include <WindowsConstants.au3>
- #include <GUIComboBox.au3>
- #include <GuiConstantsEx.au3>
- #include <Constants.au3>
- #include <GUIListBox.au3>
- #include <GuiConstantsEx.au3>
- #include <GuiListView.au3>
- #InClude <Process.Au3>
- #include <StaticConstants.au3>
- #include <EditConstants.au3>
- #include <Constants.au3>
- #include <StaticConstants.au3>
- #include <ProgressConstants.au3>
- Opt("GUIResizeMode", 802)
-
- Global $title="踹小孩·特工组 Win7系统安装工具",$WinSize
- Global $Image[20],$LevelInfo[20],$LevelDiscrip[20],$BUILD[20],$SPBUILD[20],$FullInfo[20],$Langue[20]
- Global $FileNum,$FilePath,$ImageFIle
- Global $PageNum=1,$LevelForm ,$Levelgroup,$LevelView,$SelectMoreButton,$SelectNextButton,$SelectCancelButton,$Levelgroup2,$LevelLabel
- Global $DosTool=@TempDir&'\DsptW.eXe'
- Global $IniFile=@TempDir&'\DskVol.InI'
- Global $ShowDrive=@TempDir&'\ShowDrive.eXe'
- Global $ComLine=$DosTool&' /A /Pdr >'&$IniFile
- Global $DiskForm,$DiskGroup,$DiskList,$DiskNextButton,$DiskCancelButton,$diskgroup2,$diskcheck,$DiskRadio1,$DiskRadio2,$DiskCombo,$DiskRadio3
- Global $LevelMode,$DiskPar,$ActivePar,$TarPar,$TarLan,$FormMode,$OldRead
- Global $progressform,$add, $clear, $mylist, $Button1, $nmsg,$EditPage=2, $BootRes=0,$FixRes=0,$ChangeRes=0,$Progress1,$ProLabe1,$ProLabe2,$ProLabe3,$ProLabe4,$ProLabe5,$ProButton1,$ProButton2,$ProgressEdit
-
- If $CmdLine[0] >0 Then
- $FilePath=$CmdLine[1]
- _FirstForm()
- Else
- If FileExists(@ScriptDir&"Install.wim") Then
- $FilePath=@ScriptDir&"Install.wim"
- Else
- $var = DriveGetDrive( "all" )
- If NOT @error Then
- For $i = 1 to $var[0]
- If FileExists($var[$i]&"\sources\Install.wim") Then
- $FilePath=$var[$i]&"\sources\Install.wim"
- $i=$var[0]+1
- EndIf
- Next
- EndIf
- If $FilePath= '' Then $FilePath=FileOpenDialog ( "请选择镜像文件", @ScriptDir, "IMageX镜像文件(*.wim)",3)
- EndIf
- If $FilePath<> '' Then _FirstForm()
- EndIf
- ;$FilePath='J:\sources\Install.wim'
- ;_FirstForm()
-
- Func _FirstForm()
- TrayTip("初始化程序中","正在解压核心程序...",3000)
- FileInstall('imagex.exe',@TempDir&'\imagex.exe')
- TrayTip("初始化程序中","正在提取镜像信息...",3000)
- RunWait('cmd /c '&@TempDir&'\imagex.exe'&' /info '&$FilePath&' >'&@TempDir&'\wim.txt',@ScriptDir,@SW_HIDE)
- _ReadWim(@TempDir&'\wim.txt')
- FileDelete(@TempDir&'\wim.txt')
- For $i = 1 To $FileNum
- TrayTip("初始化程序中","正在提取卷信息...",3000)
- RunWait('cmd /c '&@TempDir&'\imagex.exe'&' /info '&$FilePath&' '&$i&' >'&@TempDir&'\wim'&$i&'.txt',@ScriptDir,@SW_HIDE)
- Dim $TXT=@TempDir&'\wim'&$i&'.txt'
- _ReadFullWim($TXT,$i)
- FileDelete($TXT )
- Next
- TrayTip("","",0)
- _InitialLevelForm()
- EndFunc
- Func _SecondForm()
- TrayTip("磁盘初始化中","正在获取信息...",3000)
- If Not FileExists($ShowDrive) Then FileInstall('ShowDrive.Vxd',$ShowDrive,1)
- _RunDOS($ShowDrive)
- If Not FileExists($DosTool) Then FileInstall('DsptW.Vxd',$DosTool,1)
- _RunDOS($ComLine)
-
- TrayTip("","",0)
- _IniTialDiskFOrm()
- $PageNum=2
- EndFunc
-
- Func _InitialLevelForm()
- #Region ### START Koda GUI section ### Form=
- $LevelForm = GUICreate($title, 490, 400, -1, -1)
- $Levelgroup = GUICtrlCreateGroup("请选择系统", 15, 15, 450, 200)
-
- Global $LevelView = _GUICtrlListView_Create($LevelForm, "", 25, 30, 430, 180)
- GUICtrlSetState($LevelView,$GUI_HIDE)
- _GUICtrlListView_SetExtendedListViewStyle($LevelView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
- _GUICtrlListView_InsertColumn($LevelView, 0, "卷号", 40,2)
- _GUICtrlListView_InsertColumn($LevelView, 1, "系统全称", 280,0)
- _GUICtrlListView_InsertColumn($LevelView, 2, "版本号", 50,2)
- _GUICtrlListView_InsertColumn($LevelView, 3, "版本标识", 60,2)
- ;_GUICtrlListView_InsertColumn($LevelView, 4, "描述", 300,2)
- For $i=1 To $FileNum
- _GUICtrlListView_AddItem($LevelView, $i, $i)
- _GUICtrlListView_AddSubItem($LevelView, $i-1, $Levelinfo[$i], 1)
- _GUICtrlListView_AddSubItem($LevelView, $i-1, $BUILD[$i], 2)
- _GUICtrlListView_AddSubItem($LevelView, $i-1, $SPBUILD[$i], 3)
-
- Next
-
- GUICtrlCreateGroup("", -99, -99, 1, 1)
- $Levelgroup2=GUICtrlCreateGroup("详细描述", 15, 220, 450, 100)
- $LevelLabel=GUICtrlCreateLabel(" 点击卷列表以获得更多信息",25,240,435,50,$SS_left )
- GUICtrlCreateGroup("", -99, -99, 1, 1)
-
- $SelectMoreButton =GUICtrlCreateButton("详细描述",250,330,65,20)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $SelectNextButton =GUICtrlCreateButton("下一步",325,330,65,20)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $SelectCancelButton =GUICtrlCreateButton("取消",395,330,65,20)
- GUISetState(@SW_SHOW,$LevelForm)
- #EndRegion ### END Koda GUI section ###
- EndFunc
- Func _IniTialDiskFOrm()
- #Region ### START Koda GUI section ### Form=
- $DiskForm = GUICreate($title, 490, 400, $WinSize[0], $WinSize[1])
- $DiskGroup = GUICtrlCreateGroup("请选择系统分区", 15, 15, 450, 200)
-
- Global $DiskList = _GUICtrlListView_Create($DiskForm, "", 25, 30, 430, 180)
- GUICtrlSetState($DiskList,$GUI_HIDE)
- _GUICtrlListView_SetExtendedListViewStyle($DiskList, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
- _GUICtrlListView_InsertColumn($DiskList, 0, "驱动器", 50,2)
- _GUICtrlListView_InsertColumn($DiskList, 1, "分区编号", 60,2)
- _GUICtrlListView_InsertColumn($DiskList, 2, "分区状态", 60,2)
- _GUICtrlListView_InsertColumn($DiskList, 3, "卷标", 100,2)
- _GUICtrlListView_InsertColumn($DiskList, 4, "已用空间", 60,1)
- _GUICtrlListView_InsertColumn($DiskList, 5, "剩余空间", 60,1)
- _GUICtrlListView_InsertColumn($DiskList, 6, "类型", 60,0)
- Local $diskinfo=FileOpen($IniFile)
- Local $TotalLine=0
- While 1
- FileReadLine($diskinfo,$TotalLine)
- If @error=-1 Then ExitLoop
- $TotalLine +=1
- WEnd
- Local $LineRead
- For $LineRead =3 To $TotalLine -2
- Local $LineForRead=FileReadLine($diskinfo,$LineRead)
- Local $InfoForRead=StringSplit($LineForRead," ")
- For $i = 1 To $InfoForRead[0]
- If $i = 1 Then
- _GUICtrlListView_AddItem($DiskList, StringStripWS($InfoForRead[$i],8), $LineRead-3)
- _GUICtrlListView_AddSubItem($DiskList, $LineRead-3, DriveGetFileSystem(StringStripWS($InfoForRead[$i],8)), 6)
- ;_GUICtrlListView_AddSubItem($DiskList, $LineRead-3, 'FAT32', 6)
- Else
- If $InfoForRead[$i]="A" Then
- $InfoForRead[$i]="活动"
- $ActivePar=$InfoForRead[$i-2]
- EndIf
-
- _GUICtrlListView_AddSubItem($DiskList, $LineRead-3, StringStripWS($InfoForRead[$i],8), $i-1)
- EndIf
-
- Next
-
- Next
- ;DriveGetFileSystem
- GUICtrlCreateGroup("", -99, -99, 1, 1)
- $diskgroup2=GUICtrlCreateGroup("其他操作", 15, 220, 450, 100)
- $diskcheck=GUICtrlCreateCheckbox("手动选择系统盘符",25,235,200)
- $diskRadio1=GUICtrlCreateRadio("格式化目标分区",25,255,220)
- GUICtrlSetState(-1,$Gui_Checked)
- $diskRadio2=GUICtrlCreateRadio("仅删除目标分区系统文件",25,275,220)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $DiskRadio3=GUICtrlCreateRadio("保留目标分区系统文件(重命名)",25,295,220)
- $DiskCombo= GUICtrlCreateCombo("",260,235,60)
- GUICtrlSetData(-1, "C:|D:|E:|F:|G:|H:|I:|J:|K:|L:|M:|N:|O:|P:|Q:|R:|S:|T:|U:|V:|W:|Y:", "C:")
- GUICtrlSetState(-1,$GUI_DISABLE)
- GUICtrlCreateGroup("", -99, -99, 1, 1)
- $DiskNextButton =GUICtrlCreateButton("下一步",325,330,65,20)
- GUICtrlSetState(-1,$GUI_DISABLE)
- $DiskCancelButton =GUICtrlCreateButton("取消",395,330,65,20)
- #EndRegion ### END Koda GUI section ###
- EndFunc
-
- ;_ProgressForm()
- Func _ProgressForm()
- #Region ### START Koda GUI section ### Form=
- $progressform=GUICreate($title, 480, 150, $WinSize[0], $WinSize[1]);150
- $ProgressEdit = GUICtrlCreateEdit("", 16, 152, 449, 169)
- GUICtrlSetState(-1,$gui_disable)
- $ProLabe1 = GUICtrlCreateLabel("文件解压进度:", 16, 16, 120, 17)
- $Progress1 = GUICtrlCreateProgress(16, 40, 446, 17)
- $ProLabe2 = GUICtrlCreateLabel("剩余时间: --:--", 340, 16, 120, 17)
- $ProLabe3 = GUICtrlCreateLabel("引导文件修复:", 16, 64, 300, 17)
- $ProLabe4 = GUICtrlCreateLabel("系统文件修正:", 16, 88, 300, 17)
- $ProLabe5 = GUICtrlCreateLabel("系统盘符修正:", 16, 112, 300, 17)
- $ProButton1 = GUICtrlCreateButton("执行", 384, 104, 75, 25)
- $ProButton2 = GUICtrlCreateButton("详细过程", 296, 104, 75, 25)
- GUICtrlSetState(-1,$gui_disable)
- #EndRegion ### END Koda GUI section ###
- GUISetState(@SW_SHOW)
- EndFunc
-
- While $PageNum=1
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $SelectCancelButton
- ;MsgBox(4096,"haha",GUICtrlGetState($SelectNextButton))
- Exit
- Case $SelectMoreButton
- _FullInfo()
- Case $SelectNextButton
- $LevelMode=_GUICtrlListView_GetSelectedIndices($LevelView)+1
- $WinSize=WinGetPos($title,"请选择系统")
- _SecondForm()
- GUISetState(@SW_SHOW,$DiskForm)
- GUISetState(@SW_HIDE,$LevelForm)
- ;If $WinSize[0] <> "" And $WinSize[1] <> "" Then
-
- EndSwitch
-
- If GUICtrlGetState($SelectNextButton) <> 80 Then
- If _GUICtrlListView_GetSelectedIndices($LevelView) <> '' Then
- GUICtrlSetState($SelectNextButton,$Gui_enable)
-
- EndIf
- EndIf
-
- If _GUICtrlListView_GetSelectedIndices($LevelView) <> '' Then
- If GUICtrlRead($LevelLabel) <> ' '&$FullInfo[_GUICtrlListView_GetSelectedIndices($LevelView)+1] Then GUICtrlSetData($LevelLabel,' '&$FullInfo[_GUICtrlListView_GetSelectedIndices($LevelView)+1])
- EndIf
-
- WEnd
- While $PageNum=2
- $nMsg = GUIGetMsg()
- Switch $nMsg
- Case $GUI_EVENT_CLOSE ;Or $SelectCancelButton
- Exit
- Case $DiskNextButton
- $DiskPar=_GUICtrlListView_GetSelectedIndices($DiskList)+1
- $TarPar=_GUICtrlListView_GetItemText($DiskList,$DiskPar-1,0)
- If $langue[$DiskPar] <> '' Then
- $TarLan=$langue[$DiskPar]
- Else
- $TarLan='en-US'
- EndIf
- ;MsgBox(4096,"haha",$LevelMode &' ' &$DiskPar&' ' &$ActivePar&' ' &$TarPar&' ' &$TarLan)
- ;RunWait('cmd /c imagex.exe /apply '&$FilePath& ' '&$LevelMode& ' '&$TarPar&' &' & _
- ;'pause','',@SW_MAXIMIZE)
- If GUICtrlRead($diskRadio1) =1 Then
- $FormMode=1
-
- ElseIf GUICtrlRead($diskRadio2) =1 Then
- $FormMode=2
- ElseIf GUICtrlRead($diskRadio2) =1 Then
- $FormMode=3
- EndIf
- $WinSize=WinGetPos($title,"请选择系统分区")
- GUISetState(@SW_HIDE,$DiskForm)
- $PageNum=3
- _ProgressForm()
- ;GUISetState
- ;_RunImageX()
- ;GUISetState(@SW_SHOW,$DiskForm)
- ;Sleep(3000)
- ;Exit
- Case $diskCancelButton
-
-
- FileDelete(@TempDir&'\imagex.exe')
- Exit
- Case $diskcheck
- If GUICtrlRead($diskcheck)=1 Then
- GUICtrlSetState($DiskCombo,$GUI_Enable)
- ElseIf GUICtrlRead($diskcheck)<> 1 Then
- GUICtrlSetState($DiskCombo,$GUI_DISABLE)
- EndIf
-
- EndSwitch
-
- If GUICtrlGetState($diskNextButton) <> 80 Then
- If _GUICtrlListView_GetSelectedIndices($DiskList) <> '' Then
- GUICtrlSetState($diskNextButton,$Gui_enable)
- EndIf
- EndIf
-
- If _GUICtrlListView_GetSelectedIndices($DiskList) <> '' Then
- If GUICtrlRead($diskcheck) =4 Then
- If GUICtrlRead($DiskCombo)<> _GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),0) Then GUICtrlSetData($DiskCombo,_GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),0))
- EndIf
-
-
- If $OldRead <> _GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),5) Then
- If _GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),5) < 5000 Then
- GUICtrlSetState($DiskRadio3,$GUI_DISABLE)
- If GUICtrlRead($DiskRadio3) =1 Then
- GUICtrlSetState($DiskRadio3,$gui_unchecked)
- GUICtrlSetState($DiskRadio1,$gui_checked)
- EndIf
- Else
- GUICtrlSetState($DiskRadio3,$GUI_Enable)
- EndIf
-
- If _GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),6) = 'NTFS' Then
- GUICtrlSetState($DiskRadio3,$GUI_Enable)
- Else
- GUICtrlSetState($DiskRadio3,$gui_unchecked)
- GUICtrlSetState($DiskRadio1,$gui_checked)
- GUICtrlSetState($DiskRadio3,$GUI_DISABLE)
- EndIf
- $OldRead = _GUICtrlListView_GetItemText($DiskList,_GUICtrlListView_GetSelectedIndices($DiskList),5)
- EndIf
-
- EndIf
- WEnd
- While $PageNum=3
- $nmsg = GUIGetMsg()
- Switch $nmsg
- Case $GUI_EVENT_CLOSE
- Exit
- Case $ProButton1
- If $FormMode=1 Then
- TrayTip("操作过程","正在格式化磁盘",5000)
- _FormatIt()
- ElseIf $FormMode=2 Then
- _renOld()
- EndIf
- ;TrayTip("操作过程","正在解压镜像",5000)
- TrayTip("","",0)
- _ImageX()
- TrayTip("操作过程","正在修复引导",2000)
- _FixBoot()
- TrayTip("操作过程","正在修复系统位置",2000)
- _FixLetter()
- TrayTip("操作过程","正在更改系统盘符",2000)
- _ChangeLetter()
- If $BootRes=$FixRes=$ChangeRes=1 Then
- GUISetState(@SW_HIDE)
- TrayTip("操作结束","系统文件复制成功,请重启以继续安装",3000)
- Sleep(3000)
- Exit
- EndIf
- Case $ProButton2
- If $EditPage=1 Then
- WinMove($title,"",Default,Default,Default,170)
- GUICtrlSetData($ProButton2,"详细过程")
- $EditPage=2
- Else
- WinMove($title,"",Default,Default,Default,370)
- GUICtrlSetData($ProButton2,"隐藏过程")
- $EditPage=1
- EndIf
- EndSwitch
- WEnd
-
-
-
-
-
- Func _ReadWim($GhostFname)
- Local $IniLineSum=0 ; 每次读取一行文本,直到文件结束.
- ;$DrivePath="c"
- Dim $EndNum,$FOne=0,$CDriver,$DDriver,$result=''
-
- Dim $TempNum=1
-
- While 1
- $line = FileReadLine($GhostFname,$inilinesum)
- If @error = -1 Then ExitLoop
- ;//-----------------卷号-------
- If StringLeft($line,12)="Image Count:" Then
- $FileNum=StringRight($line,StringLen($line)-13)
- EndIf
- If StringLeft(StringStripWS($line,1),6)='<IMAGE' Then
- $Image[$TempNum]=$inilinesum
- $result=$result& ' ' &@crlf&$Image[$TempNum]
- $TempNum+=1
- EndIf
-
- $inilinesum+=1
- WEnd
-
- $EndNum=$inilinesum-1
- $Image[$TempNum]=$EndNum
- $inilinesum=0
-
- $result=''
-
- For $i=1 To $FileNum
- $x=$Image[$i]
- While $x<$Image[$i+1]
- $line = FileReadLine($GhostFname,$x)
- If StringLeft(StringStripWS($line,1),6)='<NAME>' Then
- $LevelInfo[$i]=_XmlChange($line)
- $result=$result& ' ' &@crlf&$LevelInfo[$i]
- ;MsgBox(4096,"haha",$i & $info[$i])
- ElseIf StringLeft(StringStripWS($line,1),12)='<DISPLAYNAME' Then
- $LevelDiscrip[$i]=_XmlChange($line)
- ;MsgBox(4096,"haha",$LevelDiscrip[$i])
- $result=$result& ' ' &@crlf&$LevelDiscrip[$i]
- ElseIf StringLeft(StringStripWS($line,1),6)='<BUILD' Then
- $BUILD[$i]=_XmlChange($line)
- $result=$result& ' ' &@crlf&$BUILD[$i]
- ElseIf StringLeft(StringStripWS($line,1),8)='<SPBUILD' Then
- $SPBUILD[$i]=_XmlChange($line)
- $result=$result& ' ' &@crlf&$SPBUILD[$i]
- ElseIf StringLeft(StringStripWS($line,1),10)='<LANGUAGE>'Then
- $langue[$i]=_XmlChange($line)
- EndIf
- $x+=1
- WEnd
- Next
-
- EndFunc
- Func _ReadFullWim($GhostFname,$i)
- Dim $FileNum,$EndNum,$IniLineSum=1,$FullInfo
- While 1
- $line = FileReadLine($GhostFname,$IniLineSum)
- If @error Then ExitLoop
-
- If StringLeft(StringStripWS($line,1),9)='<DISPLAYD' Then
- $FullInfo[$i]=_XmlChange($line)
- ExitLoop
- EndIf
- $IniLineSum+=1
- WEnd
-
- EndFunc
- Func _FullInfo()
- $result1=_GUICtrlListView_GetSelectedIndices($LevelView)+1
- MsgBox(4096,$LevelDiscrip[$result1],$FullInfo[$result1])
- EndFunc
- Func _XmlChange($TxtInfo)
- Dim $PreRead=StringSplit(StringStripWS($TxtInfo,1),"<")
- Dim $NextRead=StringSplit($PreRead[2],">")
- Return $NextRead[2]
- EndFunc
- Func _RunImageX()
-
- FileInstall('bcdboot.exe',@TempDir&'\bcdboot.exe')
- FileInstall('fixletter.cmd',@TempDir&'\fixletter.cmd')
- FileInstall('osletter7.cmd',@TempDir&'\osletter7.cmd')
- FileInstall("bootsect.exe", @TempDir&'\bootsect.exe',1)
- RunWait('cmd /c '&@TempDir&'\imagex.exe'&' /apply '&$FilePath& ' '&$LevelMode& ' '&$TarPar&' &' & _
- ''&@TempDir&'\bcdboot.exe'&' '&$TarPar&'\windows /s '&$ActivePar&' /l '&$TarLan&' &' & _
- ''&@TempDir&'\fixletter.cmd'&' /currentos:'&$TarPar&' &' & _
- ''&@TempDir&'\osletter7.cmd'&' /targetletter:'&$TarPar&' /currentos:'&$ActivePar&' &' & _
- ''&@TempDir&'\bootsect.exe /nt60 sys &' & _
- ''&@TempDir&'\bootsect.exe /nt60 '&$ActivePar&' &' & _
- 'pause',@ScriptDir,@SW_MAXIMIZE)
- FileDelete(@TempDir&'\bcdboot.exe')
- FileDelete(@TempDir&'\fixletter.cmd')
- FileDelete(@TempDir&'\osletter7.cmd')
- FileDelete(@TempDir&'\bootsect.exe')
- EndFunc
- Func _DeleteDir()
-
- If FileExists($TarPar&'\windows') Then
- TrayTip("文件操作","正在删除Windows文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\windows"')
- EndIf
- If FileExists($TarPar&'\Program Files') Then
- TrayTip("文件操作","正在删除Program Files文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Program Files"')
- EndIf
- If FileExists($TarPar&'\ProgramData') Then
- TrayTip("文件操作","正在删除ProgramData文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\ProgramData"')
- EndIf
- If FileExists($TarPar&'\Users') Then
- TrayTip("文件操作","正在删除Users文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Users"')
- EndIf
- If FileExists($TarPar&'\PerfLogs') Then
- TrayTip("文件操作","正在删除PerfLogs文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\PerfLogs"')
- EndIf
- If FileExists($TarPar&'\Documents and Settings') Then
- TrayTip("文件操作","正在删除PerfLogs文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Documents and Settings"')
- EndIf
- TrayTip("","",0)
- EndFunc
- Func _DeleteDirOld()
-
- If FileExists($TarPar&'\windows.old') Then
- TrayTip("文件操作","正在删除Windows.old文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\windows.old"')
- EndIf
- If FileExists($TarPar&'\Program Files.old') Then
- TrayTip("文件操作","正在删除Program Files.old文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Program Files.old"')
- EndIf
- If FileExists($TarPar&'\ProgramData.old') Then
- TrayTip("文件操作","正在删除ProgramData文件夹.old",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\ProgramData.old"')
- EndIf
- If FileExists($TarPar&'\Users.old') Then
- TrayTip("文件操作","正在删除Users.old文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Users.old"')
- EndIf
- If FileExists($TarPar&'\PerfLogs.old') Then
- TrayTip("文件操作","正在删除PerfLogs.old文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\PerfLogs.old"')
- EndIf
- If FileExists($TarPar&'\Documents and Settings.old') Then
- TrayTip("文件操作","正在删除PerfLogs.old文件夹",3000)
- RunWait('cmd /c rd /s /q "'&$TarPar&'\Documents and Settings.old"')
- EndIf
- RunWait('cmd /c ren "'&$TarPar&'\windows" "windows.old" &' & _
- 'ren "'&$TarPar&'\Program Files" "Program Files.old" &' & _
- 'ren "'&$TarPar&'\ProgramData" "ProgramData.old" &' & _
- 'ren "'&$TarPar&'\Users" "Users.old" &' & _
- 'ren "'&$TarPar&'\PerfLogs" "PerfLogs.old" &' & _
- 'ren "'&$TarPar&'\Documents and Settings" "Documents and Settings.old" &' & _
- 'pause')
-
- TrayTip("","",0)
- EndFunc
- Func _FormatIt()
- RunWait("cmd /c format /fs:ntfs /q /y " & $TarPar&'')
- EndFunc
- Func _renOld()
- FileSetAttrib ( $TarPar&'\ProgramData', "-RSH")
- FileSetAttrib ( $TarPar&'\Documents and Settings', "-RSH")
- Local $search = FileFindFirstFile($TarPar&"\*.*"),$result1=''
- While 1
- Dim $file = FileFindNextFile($search)
- If @error Then ExitLoop
- If $result1='' Then
- $result1='ren "'&$TarPar &'\'&$file&'" "'&$file&'.old"'
- Else
- $result1 =$result1 &' & ren "'&$TarPar &'\'&$file&'" "'&$file&'.old"'
- EndIf
- WEnd
- RunWait("cmd /c " & $result1 &'','',@SW_HIDE)
- EndFunc
-
- ;//-------------------New----------------------------------------
- Func _ImageX()
- Local $foo, $line, $lines, $currentRead
- GUICtrlSetState($ProButton2,$gui_enable)
- $foo = Run('cmd /c '&@TempDir&'\imagex.exe'&' /apply '&$FilePath& ' '&$LevelMode& ' '&$TarPar&' ', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
- While 1
- $line = StdoutRead($foo)
- If @error Then ExitLoop
- $msg = GUIGetMsg()
- Select
- Case $msg =$ProButton2
-
- If $EditPage=1 Then
- WinMove($title,"",Default,Default,Default,170)
- GUICtrlSetData($ProButton2,"详细过程")
- $EditPage=2
- ElseIf $EditPage=2 Then
- WinMove($title,"",Default,Default,Default,370)
- GUICtrlSetData($ProButton2,"隐藏过程")
- $EditPage=1
- EndIf
- EndSelect
-
- GUICtrlSetData($ProgressEdit, $line, -1)
- Dim $Progress,$ProgressA,$ProgressB,$RemainTime='',$RemainTimeA,$RemainTimeB,$RemainTimeC
- If StringStripWS($line,8)<>"" Then
- Dim $TxtRead=StringStripCR($line)
- If StringInStr($TxtRead,"Applying progress") Then
- $ProgressA=StringSplit($TxtRead,"]")
- $ProgressB=StringSplit($ProgressA[1],"[")
- $Progress=StringStripCR(StringStripWS($ProgressB[2],8))
- EndIf
- GUICtrlSetData($Progress1,StringTrimRight($Progress,1))
- GUICtrlSetData($ProLabe1,"文件解压进度: " &$Progress )
- If StringInStr($TxtRead,"remaining") Then
- $RemainTimeA=StringSplit(StringLeft($TxtRead,StringLen($TxtRead)-10),"o")
- $RemainTimeB=StringRight($RemainTimeA[2],StringLen($RemainTimeA[2])-7)
- If StringInStr($RemainTimeB,"mins") Then
- $RemainTimeC=StringSplit($RemainTimeB,":")
- $RemainTime="剩余时间: "&$RemainTimeC[1]&" 分 "&StringLeft($RemainTimeC[2],2)&" 秒 "
- ElseIf StringInStr($RemainTimeB,"sec") Then
- $RemainTime=StringLeft(StringStripCR(StringStripWS($RemainTimeB,8)),2)
- If StringRight($RemainTime,1)="s" Then $RemainTime=StringLeft($RemainTime,1)
- $RemainTime="剩余时间: "&$RemainTime&" 秒 "
- EndIf
- EndIf
- If $RemainTime <> '' Then
-
- GUICtrlSetData($ProLabe2,$RemainTime)
- EndIf
- If StringInStr($TxtRead,"Successfully") Then
- GUICtrlSetData($ProLabe2,"")
- GUICtrlSetData($ProLabe1,"文件解压进度: 完成 ")
- EndIf
- EndIf
- WEnd
- EndFunc
- Func _FixLetter()
- Local $foo1, $line, $lines, $currentRead
- GUICtrlSetState($ProButton2,$gui_enable)
- FileInstall('fixletter.cmd',@TempDir&'\fixletter.cmd')
- ;RunWait("cmd /c echo "&@TempDir&'\fixletter.cmd'&' /currentos:'&$TarPar&' & pause', @ScriptDir)
- $foo1 = Run("cmd /c "&@TempDir&'\fixletter.cmd'&' /currentos:'&$TarPar&' & pause', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
- While 1
- $line = StdoutRead($foo1)
- If @error Then ExitLoop
-
- $msg = GUIGetMsg()
- Select
- Case $msg =$ProButton2
-
- If $EditPage=1 Then
- WinMove($title,"",Default,Default,Default,170)
- GUICtrlSetData($ProButton2,"详细过程")
- $EditPage=2
- ElseIf $EditPage=2 Then
- WinMove($title,"",Default,Default,Default,370)
- GUICtrlSetData($ProButton2,"隐藏过程")
- $EditPage=1
- EndIf
- EndSelect
- GUICtrlSetData($ProgressEdit, $line, -1)
- If StringStripWS($line,8)<>"" Then
- Dim $TxtRead=StringStripCR($line)
- If StringInStr($TxtRead,"Failure") Then
- GUICtrlSetData($ProLabe4,"系统文件修正: 失败 (详情请查看详细过程)")
- $FixRes=2
- ElseIf StringInStr($TxtRead,"Script completed") Then
- GUICtrlSetData($ProLabe4,"系统文件修正: 成功")
- $FixRes=1
- EndIf
- EndIf
- WEnd
-
- If $FixRes=0 Then GUICtrlSetData($ProLabe4,"系统文件修正: 失败 (详情请查看详细过程)")
- FileDelete(@TempDir&'\fixletter.cmd')
- EndFunc
-
- Func _ChangeLetter()
- Local $foo2, $line, $lines, $currentRead
- FileInstall('osletter7.cmd',@TempDir&'\osletter7.cmd')
- $foo2 = Run("cmd /c "&@TempDir&'\osletter7.cmd'&' /targetletter:'&$TarPar&' /currentos:'&$ActivePar&' ', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
- While 1
- $line = StdoutRead($foo2)
- If @error Then ExitLoop
-
- $msg = GUIGetMsg()
- Select
- Case $msg =$ProButton2
-
- If $EditPage=1 Then
- WinMove($title,"",Default,Default,Default,170)
- GUICtrlSetData($ProButton2,"详细过程")
- $EditPage=2
- ElseIf $EditPage=2 Then
- WinMove($title,"",Default,Default,Default,370)
- GUICtrlSetData($ProButton2,"隐藏过程")
- $EditPage=1
- EndIf
- EndSelect
- GUICtrlSetData($ProgressEdit, $line, -1)
- If StringStripWS($line,8)<>"" Then
- Dim $TxtRead=StringStripCR($line)
- If StringInStr($TxtRead,"Failure") Then
- GUICtrlSetData($ProLabe5,"系统盘符修正: 失败 (详情请查看详细过程)")
- $ChangeRes=2
- ElseIf StringInStr($TxtRead,"Script completed") Then
- GUICtrlSetData($ProLabe5,"系统盘符修正: 成功")
- $ChangeRes=1
- EndIf
- EndIf
- WEnd
- If $ChangeRes=0 Then GUICtrlSetData($ProLabe5,"系统文件修正: 失败 (详情请查看详细过程)")
- FileDelete(@TempDir&'\osletter7.cmd')
- FileInstall("bootsect.exe", @TempDir&'\bootsect.exe',1)
- RunWait('cmd /c '&@TempDir&'\bootsect.exe /nt60 sys &' & _
- ''&@TempDir&'\bootsect.exe /nt60 '&$ActivePar&' ', "",@SW_HIDE)
- FileDelete(@TempDir&'\bootsect.exe')
- EndFunc
-
- Func _FixBoot()
- Local $foo3, $line, $lines, $currentRead
- FileInstall('bcdboot.exe',@TempDir&'\bcdboot.exe')
- $foo3 = Run("cmd /c "&@TempDir&'\bcdboot.exe'&' '&$TarPar&'\windows /s '&$ActivePar&' /l '&$TarLan&' ', @ScriptDir, @SW_HIDE, $STDOUT_CHILD)
- While 1
- $line = StdoutRead($foo3)
- If @error Then ExitLoop
-
- $msg = GUIGetMsg()
- Select
- Case $msg =$ProButton2
-
- If $EditPage=1 Then
- WinMove($title,"",Default,Default,Default,170)
- GUICtrlSetData($ProButton2,"详细过程")
- $EditPage=2
- ElseIf $EditPage=2 Then
- WinMove($title,"",Default,Default,Default,370)
- GUICtrlSetData($ProButton2,"隐藏过程")
- $EditPage=1
- EndIf
- EndSelect
- GUICtrlSetData($ProgressEdit, $line, -1)
- If StringStripWS($line,8)<>"" Then
- Dim $TxtRead=StringStripCR($line)
- If StringInStr($TxtRead,"Failure") Then
- GUICtrlSetData($ProLabe3,"引导文件修复: 失败 (详情请查看详细过程)")
- $BootRes=2
- ElseIf StringInStr($TxtRead,"successfully") Then
- GUICtrlSetData($ProLabe3,"引导文件修复: 成功")
- $BootRes=1
- EndIf
- EndIf
- WEnd
- If $BootRes=0 Then GUICtrlSetData($ProLabe3,"引导文件修复: 失败 (详情请查看详细过程)")
- FileDelete(@TempDir&'\bcdboot.exe')
- EndFunc
-
复制代码 |
|