Dim $Msg, $rFile, $iPath, $tPath, $sLoca
$Msg = "Example: HojoHE.exe -Sdefault -ID:\aaa -TE:\aaa\bbb -L00000409"
If $CmdLine[0]=4 Then
If StringLeft($CmdLine[1],2)="-S" And StringLeft($CmdLine[2],2)="-I" And StringLeft($CmdLine[3],2)="-T" And StringLeft($CmdLine[4],2)="-L" Then
$rFile = StringMid($CmdLine[1],3)
$iPath = StringMid($CmdLine[2],3)
$tPath = StringMid($CmdLine[3],3)
$sLoca = StringMid($CmdLine[4],3)
Else
MsgBox(0,"Error", "Input Error"& @CRLF & @CRLF & $msg)
EndIf
ElseIf $CmdLine[0]=3 Then
If StringLeft($CmdLine[1],2)="-S" And StringLeft($CmdLine[2],2)="-I" And StringLeft($CmdLine[3],2)="-T" Then
$rFile = StringMid($CmdLine[1],3)
$iPath = StringMid($CmdLine[2],3)
$tPath = StringMid($CmdLine[3],3)
Else
MsgBox(0,"Error", "Input Error"& @CRLF & @CRLF & $msg)
EndIf
ElseIf $CmdLine[0]=1 Then
If ($CmdLine[1])="?" Then
MsgBox(0,"Exp", $Msg)
Else
MsgBox(0,"Error", "Input Error" & @CRLF & @CRLF & "Example: HojoHE.exe ?")
EndIf
Else
MsgBox(0,"Error", "Input Error" & @CRLF & @CRLF & $Msg)
EndIf
; 以下这段太罗嗦了,用vbs 可以数组解决,AU3 我就不会了。
If FileExists($tPath) = 0 Then DirCreate($tPath)
Dim $ss, $File
Select
Case $rFile = "default"
If FileExists($iPath & "\HIVEDEF.INF") Then FileCopy($iPath & "\HIVEDEF.INF", $tPath, 1)
$File = $tPath & "\HIVEDEF.INF"
FileProcess()
Case $rFile = "software"
If FileExists($iPath & "\HIVESFT.INF") Then
FileCopy($iPath & "\HIVESFT.INF", $tPath, 1)
$File = $tPath & "\HIVESFT.INF"
FileProcess()
EndIf
If FileExists($iPath & "\HIVECLS.INF") Then
FileCopy($iPath & "\HIVECLS.INF", $tPath, 1)
$File = $tPath & "\HIVECLS.INF"
FileProcess()
EndIf
If FileExists($iPath & "\HIVESXS.INF") Then
FileCopy($iPath & "\HIVESXS.INF", $tPath, 1)
$File = $tPath & "\HIVESXS.INF"
FileProcess()
EndIf
If FileExists($iPath & "\HIVSFT32.INF") Then
FileCopy($iPath & "\HIVSFT32.INF", $tPath, 1)
$File = $tPath & "\HIVSFT32.INF"
FileProcess()
EndIf
If FileExists($iPath & "\HIVCLS32.INF") Then
FileCopy($iPath & "\HIVCLS32.INF", $tPath, 1)
$File = $tPath & "\HIVCLS32.INF"
FileProcess()
EndIf
If FileExists($iPath & "\DMREG.INF") Then
FileCopy($iPath & "\DMREG.INF", $tPath, 1)
$File = $tPath & "\DMREG.INF"
FileProcess()
EndIf
Case $rFile = "setupreg.hiv"
If FileExists($iPath & "\HIVESYS.INF") Then FileCopy($iPath & "\HIVESYS.INF", $tPath, 1)
$File = $tPath & "\HIVESYS.INF"
FileProcess()
Case Else
MsgBox(0, "Error", "The parameter isn't supported!" & @CRLF & @CRLF & "Must be 'default', or 'software', or 'setupreg.hiv'.")
EndSelect
Func FileProcess()
MsgBox(0,"Error", $File)
;此处,如何判断相应文件,如果是ANSI格式,转换为 unicode 格式?
;此处,如何查找并替换相应文本中的字符串,如果存在就替换,不存在就忽略,并添加行?
;需要替换的内容:
;HKCU," 替换为 HKLM,"WB-default\ (HKCU, 后面可能有空格,如果存在就替换,否则忽略,下同)
;HKLM,"SYSTEM\ 为 HKLM,"WB-setup\
;HKLM,"SOFTWARE\ 为 HKLM,"WB-software\
;HKCR," 为 HKLM,"WB-software\Classes\
;HKCR,. 为 HKLM,WB-software\Classes\.
;添加 [DefaultInstall] 和其下面的 AddReg = AddReg 和 AddReg = AddReg.Upgarde 行
EndFunc