📄 winsetupfromusb_0-1-1.au3
字号:
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\I386")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\minint"
;Setup
If FileExists($PESource & "\Setup\") Then
If FileExists($TargetDrive & "\Setup\") Then
$msg = MsgBox(48 + 3, "Folder Setup exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF _
& "CANCEL to return to the main menu")
If $msg = 6 Then DirMove($TargetDrive & "\Setup", $TargetDrive & "\Setup.BKP")
If $msg = 7 Then DirRemove ($TargetDrive & "\Setup", 1)
If $msg = 2 Then ExitLoop
EndIf
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource & "\Setup")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\Setup")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\Setup"
EndIf
;programs
If FileExists($PESource & "\programs\") Then
If FileExists($TargetDrive & "\programs\") Then
$msg = MsgBox(48 + 3, "Folder PROGRAMS exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF _
& "CANCEL to return to the main menu")
If $msg = 6 Then DirMove($TargetDrive & "\programs\", $TargetDrive & "\programs.BKP\")
If $msg = 7 Then DirRemove ($TargetDrive & "\programs\", 1)
If $msg = 2 Then ExitLoop
EndIf
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource & "\programs")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\programs")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\programs"
ElseIf FileExists($PESource & "\program files\") Then
If FileExists($TargetDrive & "\program files\") Then
$msg = MsgBox(48 + 3, "Folder PROGRAM FILES exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF _
& "CANCEL to return to the main menu")
If $msg = 6 Then DirMove($TargetDrive & "\program files\", $TargetDrive & "\program files.BKP\")
If $msg = 7 Then DirRemove ($TargetDrive & "\program files\", 1)
If $msg = 2 Then ExitLoop
EndIf
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource & "\program files")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\program files")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\program files"
EndIf
;files to root
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource, Default, 1, Default, False)
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource)
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive
;ubcd4win
If StringInStr(IniRead($PESource & "\I386\system32\OEMINFO.INI", "General", "Model", "" ), "UBCD4Win") > 0 Then
If FileExists($PESource & "\images\") Then
If FileExists($TargetDrive & "\images\") Then
$msg = MsgBox(48 + 3, "Folder IMAGES exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF _
& "CANCEL to return to the main menu")
If $msg = 6 Then DirMove($TargetDrive & "\images", $TargetDrive & "\images.BKP")
If $msg = 7 Then DirRemove ($TargetDrive & "\images", 1)
If $msg = 2 Then ExitLoop
EndIf
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource & "\images")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\images")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\images"
FileCopy(@ScriptDir & "\files\grub4dos\UBCD4WIN.LST", $TargetDrive, 1)
EndIf
If FileExists($PESource & "\cmdc\") Then
If FileExists($TargetDrive & "\cmdcons\") Then
$msg = MsgBox(48 + 3, "Folder CMDCONS exists", "YES to rename it to .BKP" & @CRLF & "NO to delete it" & @CRLF _
& "CANCEL to return to the main menu")
If $msg = 6 Then DirMove($TargetDrive & "\cmdcons\", $TargetDrive & "\cmdcons.BKP\")
If $msg = 7 Then DirRemove ($TargetDrive & "\cmdcons\", 1)
If $msg = 2 Then ExitLoop
EndIf
$SourceList[0][0] += 1
$FileList = _FileSearch($PESource & "\cmdc")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($PESource & "\cmdc")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\cmdcons"
If Not FileExists($TargetDrive & "\ubcd4win.lst") Then FileCopy(@ScriptDir & "\files\grub4dos\UBCD4WIN.LST", $TargetDrive, 1)
EndIf
EndIf ;ubcd4win
;boot menu entries
If FileExists($TargetDrive & "\ubcd4win.lst") Then
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
FileWriteLine($menulst, @CRLF & "title Start UBCD4Win from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "configfile (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")/ubcd4win.lst")
FileClose($menulst)
If GUICtrlRead($AddPECheck) = $GUI_CHECKED Then
Logging("Replacing (hd0,0) with (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")" & " in ubcd4win.lst")
HexReplace($TargetDrive & "\ubcd4win.lst", "(hd0,0)", "(hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
EndIf
Else
If FileExists($PESource & "\Setup\") Then
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
FileWriteLine($menulst, @CRLF & "title Start WinFLPC setup from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
FileWriteLine($menulst, "chainloader /minint/setupldr.bin")
FileClose($menulst)
Else
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
FileWriteLine($menulst, @CRLF & "title Start BartPE/WinBuilder from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
FileWriteLine($menulst, "chainloader /minint/setupldr.bin")
FileClose($menulst)
EndIf
EndIf
EndIf ;pesource
;vista
If $VistaSource <> "" And GUICtrlRead($AddVistaCheck) = $GUI_CHECKED Then
Logging("Preparing Vista source")
_GUICtrlStatusBar_SetText($hStatus,"Preparing Vista source", 2)
$SourceList[0][0] += 1
$FileList = _FileSearch($VistaSource)
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($VistaSource)
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
FileWriteLine($menulst, @CRLF & "title Start Vista Setup/PE/Recovery from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
FileWriteLine($menulst, "chainloader /bootmgr")
FileClose($menulst)
EndIf ;vista
;GParted/PMagic
If $GPartedSource <> "" And GUICtrlRead($AddGPartedCheck) = $GUI_CHECKED Then
Logging("Preparing GParted/PMagic source")
_GUICtrlStatusBar_SetText($hStatus,"Preparing GParted source", 2)
If FileExists($GPartedSource & "\gparted.dat") Then
$SourceList[0][0] += 1
$FileList = _FileSearch($GPartedSource & "\boot")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($GPartedSource & "\boot")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\gpart348"
;gparted.dat
Dim $FileList [2]
$SourceList[0][0] += 1
$FileList[0] = 1
$FileList[1] = $GPartedSource & "\gparted.dat"
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($GPartedSource)
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive
;end grarted.dat
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
FileWriteLine($menulst, @CRLF & "title Start GParted 0.3.4-X from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
FileWriteLine($menulst, "configfile /GPart0.3.4-8.lst")
FileClose($menulst)
FileCopy(@ScriptDir & "\files\grub4dos\GPart0.3.4-8.lst", $TargetDrive, 1)
ElseIf FileExists($GPartedSource & "\GParted-Live-Version") Then
$SourceList[0][0] += 1
$FileList = _FileSearch($GPartedSource & "\live")
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($GPartedSource & "\live")
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive & "\live"
$menulst = FileOpen($TargetActive & "\menu.lst", 1)
$GpVers = FileRead($GPartedSource & "\GParted-Live-Version")
If StringInStr($GpVers, "0.3.6-7") <> 0 Then $GpVers = "0.3.6-7"
If StringInStr($GpVers, "0.3.7-7") <> 0 Then $GpVers = "0.3.7-7"
If StringInStr($GpVers, "0.3.9-4") <> 0 Then $GpVers = "0.3.9-4"
Logging("GParted version fould: " & $GpVers)
FileWriteLine($menulst, @CRLF & "title GParted " & $GpVers & " from partition " & $USBdrives[$USBdrives[0][1]][3])
FileWriteLine($menulst, "root (hd0," & $USBdrives[$USBdrives[0][1]][3] & ")")
FileWriteLine($menulst, "configfile /GPart" & $GpVers & ".lst")
FileClose($menulst)
FileCopy(@ScriptDir & "\files\grub4dos\GPart" & $GpVers & ".lst", $TargetDrive, 1)
EndIf
EndIf ;gparted
;syslinux
If GUICtrlRead($AddSysLinuxCheck) = $GUI_CHECKED Then
Logging("Preparing SysLinux source")
_GUICtrlStatusBar_SetText($hStatus,"Preparing SysLinux source", 2)
If $USBdrives[$USBdrives[0][1]][7] = "NTFS" Then
MsgBox(16, "Not supported", "Syslinux bootsector cannot be installed on a NTFS formatted partition!" & @CRLF _
& "Will copy files, but bootsector will NOT be made.")
Else
$instsyslin = 1
EndIf
If $SysLinuxSource <> "" Then
$SourceList[0][0] += 1
$FileList = _FileSearch($SysLinuxSource)
_Quick_Sort($FileList, 1, $FileList[0])
$SourceList[0][1] += $FileList[0]
ReDim $SourceList[$SourceList[0][0] + 1][3]
$SourceList[$SourceList[0][0]][0] = $FileList
$sl = StringLen($SysLinuxSource)
$SourceList[$SourceList[0][0]][1] = $sl
$SourceList[$SourceList[0][0]][2] = $TargetDrive
EndIf
EndIf ;syslinux
;copying sources
Logging("Copy started")
_GUICtrlStatusBar_SetText($hStatus,"Starting copy", 2)
$begin = TimerInit()
For $i = 1 To $SourceList[0][0]
$src = $SourceList[$i][0]
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -