' VBScript source code
'===============================================================================
'
' 将佢掉到文明4的目录下双击就得了。
' 自动取得路径,检查有冇相关文件夹,关联相关文件。
'
' 写入版本说明
' Civ4(1.00.0000,1.61,1.74),Warlords(1.00.0000,2.13),BTS(3.01,3.13,3.19)
'
' 含BTS的反安装信息,但要BTS成功注册才会写入
' 3.13版的反安装为3.01版的,方便升/降级
' 3.19版的直接就是3.19版的
'
'
' by ztjal
' 09.06.18
'===============================================================================
On Error Resume Next
'------------------------------------------------------------------------------------------
Public fso
Public Civ4Folder
Set fso = CreateObject("Scripting.FileSystemObject")
Civ4Folder = fso.GetParentFoldername(WScript.ScriptFullName)
Public Const HKEY_LOCAL_MACHINE = &H80000002
Public Const HKEY_CLASSES_ROOT = &H80000000
Public strComputer
Public StdOut
Public Civ4Reg
strComputer = "."
Set StdOut = WScript.StdOut
Set Civ4Reg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
Public doCiv4Reg
Public doCiv4WarlordReg
Public WarlordsJ
Public doCiv4BTSReg
Public RegCiv4Ok
Public RegCiv4BTSOk
Public RegCiv4WarlordOk
Public RegBts319
'------------------------------------------------------------------------------------------
Sub testValue()
strFirstMsg = "---> 看 清 楚 ! <---" & chr(13) & chr (10) & "是否要同时恢复至 3.19 版 ?" & chr(13) & chr (10) & "点 ""是/Yes"" 恢复至 3.19" _
& chr(13) & chr (10) & "点 ""否/No"" 恢复至 3.13" & chr(13) & chr (10) & "点 ""取消/Cancel"" 什么事都没发生"
iMBValue = Msgbox(strFirstMsg, VbYesNoCancel+VbQuestion+vbDefaultButton3, "文明4注册表恢复VBS")
If iMBValue = vbYes Then
RegBts319 = 1
else
If iMBValue = vbNo Then
RegBts319 = 0
else
If iMBValue = vbCancel Then
wscript.quit
end if
end if
End If
If fso.FileExists(Civ4Folder & "\Civilization4.exe") = True Then
doCiv4Reg = 1
End If
If fso.FolderExists(Civ4Folder & "\Warlords(J)") = True Then
doCiv4WarlordReg = 1
WarlordsJ = 2
Else
If fso.FolderExists(Civ4Folder & "\Warlords") = True Then
doCiv4WarlordReg = 1
WarlordsJ = 1
End If
End If
If fso.FolderExists(Civ4Folder & "\Beyond the Sword") = True Then
doCiv4BTSReg = 1
End If
End Sub
Sub RegCiv4()
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4", "INSTALLDIR", Civ4Folder
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4", "DEFAULT_LANGUAGE", 9
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4\1.00.0000"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4\1.61"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4\1.74"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civilization4.exe"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civilization4.exe\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civilization4.exe\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civilization4.exe\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Applications\Civilization4.exe\shell\open\command", , """" & Civ4Folder & "\Civilization4.exe"" /FXSLOAD=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".Civ4Replay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".Civ4Replay", , "Civ4Replay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".Civ4SavedGame"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".Civ4SavedGame", , "Civ4SavedGame"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".Civ4WorldBuilderSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".Civ4WorldBuilderSave", , "Civ4WorldBuilderSave"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4Replay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4Replay", , "Replay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4Replay\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4Replay\DefaultIcon", , Civ4Folder & "\Civilization4.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4Replay\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4Replay\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4Replay\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4Replay\shell\open\command", , """" & Civ4Folder & "\Civilization4.exe"" /FXSLOAD=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4SavedGame"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4SavedGame", , "Saved Game"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4SavedGame\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4SavedGame\DefaultIcon", , Civ4Folder & "\Civilization4.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4SavedGame\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4SavedGame\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4SavedGame\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4SavedGame\shell\open\command", , """" & Civ4Folder & "\Civilization4.exe"" /FXSLOAD=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave", , "WorldBuilder Save"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\DefaultIcon", , Civ4Folder & "\Civilization4.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Civ4WorldBuilderSave\shell\open\command", , """" & Civ4Folder & "\Civilization4.exe"" /FXSLOAD=""%1"""
If Err > 0 Then
RegCiv4Ok = 0
else
RegCiv4Ok = 1
end if
End Sub
Sub RegCiv4BTS()
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword", "INSTALLDIR", Civ4Folder & "\Beyond the Sword"
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword", "DEFAULT_LANGUAGE", 9
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword\3.01"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword\3.13"
if RegBts319 = 1 then
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Beyond the Sword\3.19"
end if
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivBeyondSwordReplay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivBeyondSwordReplay", , "CivBeyondSwordReplay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivBeyondSwordSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivBeyondSwordSave", , "CivBeyondSwordSave"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivBeyondSwordWBSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivBeyondSwordWBSave", , "CivBeyondSwordWBSave"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4BeyondSword.exe"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4BeyondSword.exe\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4BeyondSword.exe\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4BeyondSword.exe\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Applications\Civ4BeyondSword.exe\shell\open\command", , """" & Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordReplay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordReplay", , "Replay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\DefaultIcon", , Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordReplay\shell\open\command", , """" & Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordSave", , "Save Game"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordSave\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordSave\DefaultIcon", , Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordSave\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordSave\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordSave\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordSave\shell\open\command", , """" & Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave", , "WordBuilder Save"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\DefaultIcon", , Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivBeyondSwordWBSave\shell\open\command", , """" & Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe"" /fxsload=""%1"""
If Err > 0 Then
RegCiv4BTSOk = 0
else
RegCiv4BTSOk = 1
end if
End Sub
Sub RegCiv4Warlord()
Dim WarlordDir
If WarlordsJ = 2 Then
WarlordDir = "\Warlords(J)"
ElseIf WarlordsJ = 1 Then
WarlordDir = "\Warlords"
Else
Exit Sub
End If
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Warlords"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Warlords", "INSTALLDIR", Civ4Folder & WarlordDir
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Warlords", "DEFAULT_LANGUAGE", 9
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Warlords\1.00.0000"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE, "SOFTWARE\Firaxis Games\Sid Meier's Civilization 4 - Warlords\2.13"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivWarlordsReplay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivWarlordsReplay", , "CivWarlordsReplay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivWarlordsSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivWarlordsSave", , "CivWarlordsSave"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, ".CivWarlordsWBSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, ".CivWarlordsWBSave", , "CivWarlordsWBSave"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4Warlords.exe"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4Warlords.exe\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4Warlords.exe\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "Applications\Civ4Warlords.exe\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "Applications\Civ4Warlords.exe\shell\open\command", , """" & Civ4Folder & WarlordDir & "\Civ4Warlords.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsReplay"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsReplay", , "Replay"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsReplay\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsReplay\DefaultIcon", , Civ4Folder & WarlordDir & "\Civ4Warlords.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsReplay\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsReplay\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsReplay\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsReplay\shell\open\command", , """" & Civ4Folder & WarlordDir & "\Civ4Warlords.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsSave", , "Saved Game"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsSave\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsSave\DefaultIcon", , Civ4Folder & WarlordDir & "\Civ4Warlords.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsSave\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsSave\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsSave\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsSave\shell\open\command", , """" & Civ4Folder & WarlordDir & "\Civ4Warlords.exe"" /fxsload=""%1"""
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsWBSave"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsWBSave", , "WorldBuilder Save"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsWBSave\DefaultIcon"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsWBSave\DefaultIcon", , Civ4Folder & WarlordDir & "\Civ4Warlords.exe,1"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsWBSave\shell"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsWBSave\shell\open"
Civ4Reg.CreateKey HKEY_CLASSES_ROOT, "CivWarlordsWBSave\shell\open\command"
Civ4Reg.SetStringValue HKEY_CLASSES_ROOT, "CivWarlordsWBSave\shell\open\command", , """" & Civ4Folder & WarlordDir & "\Civ4Warlords.exe"" /fxsload=""%1"""
If Err > 0 Then
RegCiv4WarlordOk = 0
else
RegCiv4WarlordOk = 1
end if
End Sub
Sub UNinstallBTSReg()
strUNinstall = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{32E4F0D2-C135-475E-A841-1D59A0D22989}"
Civ4Reg.CreateKey HKEY_LOCAL_MACHINE,strUNinstall
Set WshShell = Wscript.CreateObject("Wscript.Shell")
Set WshSysEnv = WshShell.Environment("Process")
winBoot = WshSysEnv("SYSTEMDRIVE")
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "UninstallString", winBoot & "\Program Files\InstallShield Installation Information\{32E4F0D2-C135-475E-A841-1D59A0D22989}\setup.exe -runfromtemp -l0x0009 -removeonly"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "LogFile", winBoot & "\Program Files\InstallShield Installation Information\{32E4F0D2-C135-475E-A841-1D59A0D22989}\setup.ilg"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "InstallLocation", Civ4Folder & "\Beyond the Sword"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "ProductGuid", "{32E4F0D2-C135-475E-A841-1D59A0D22989}"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "InstallSource", "H:\"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "DisplayName", "Sid Meier's Civilization 4 - Beyond the Sword"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "Publisher", "Firaxis Games"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "URLInfoAbout", "http://www.2kgames.com/civ4"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "HelpLink", "http://www.2kgames.com/civ4/support.htm"
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "Readme", Civ4Folder & "\Beyond the Sword\Readme.htm"
dim temRegValue
Civ4Reg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOrganization", temRegValue
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "RegCompany", temRegValue
Civ4Reg.GetStringValue HKEY_LOCAL_MACHINE,"SOFTWARE\Microsoft\Windows NT\CurrentVersion", "RegisteredOwner", temRegValue
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "RegOwner", temRegValue
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "DisplayIcon", Civ4Folder & "\Beyond the Sword\Civ4BeyondSword.exe"
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "NoModify", 1
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "NoRemove", 0
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "NoRepair", 1
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "InstallDate", Year(now) & right("0" & Month(now),2) & right("0" & Day(now),2)
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "Language", 9
DisplayVer = "3.01"
if RegBts319 = 1 then
DisplayVer = "3.19"
end if
Civ4Reg.SetStringValue HKEY_LOCAL_MACHINE, strUNinstall, "DisplayVersion", DisplayVer
VerHex = 03000000
if RegBts319 = 1 then
VerHex = 03130000
end if
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "Version", HEX_to_DEC(VerHex)
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "MajorVersion", 3
MinVerHex = 0
if RegBts319 = 1 then
MinVerHex = HEX_to_DEC(13)
end if
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "MinorVersion", MinVerHex
Civ4Reg.SetDWORDValue HKEY_LOCAL_MACHINE, strUNinstall, "LogMode", 1
End Sub
Function HEX_to_DEC(byval Hex)
Hex = UCase(Hex)
For i = 1 To Len(Hex)
Select Case Mid(Hex, Len(Hex) - i + 1, 1)
Case "0": B = B + 16 ^ (i - 1) * 0
Case "1": B = B + 16 ^ (i - 1) * 1
Case "2": B = B + 16 ^ (i - 1) * 2
Case "3": B = B + 16 ^ (i - 1) * 3
Case "4": B = B + 16 ^ (i - 1) * 4
Case "5": B = B + 16 ^ (i - 1) * 5
Case "6": B = B + 16 ^ (i - 1) * 6
Case "7": B = B + 16 ^ (i - 1) * 7
Case "8": B = B + 16 ^ (i - 1) * 8
Case "9": B = B + 16 ^ (i - 1) * 9
Case "A": B = B + 16 ^ (i - 1) * 10
Case "B": B = B + 16 ^ (i - 1) * 11
Case "C": B = B + 16 ^ (i - 1) * 12
Case "D": B = B + 16 ^ (i - 1) * 13
Case "E": B = B + 16 ^ (i - 1) * 14
Case "F": B = B + 16 ^ (i - 1) * 15
End Select
Next
HEX_to_DEC = B
End Function
Sub main()
Call testValue()
If doCiv4Reg = 1 Then
Call RegCiv4()
If doCiv4BTSReg = 1 Then
Call RegCiv4BTS()
If RegCiv4BTSOk = 1 then
Call UNinstallBTSReg()
end if
End If
If doCiv4WarlordReg = 1 Then
Call RegCiv4Warlord()
End If
End If
End Sub
'----------------------------- Call Sub ----------------------------------------------------------------
Call main()
'----------------------------- End Message -------------------------------------------------------------
If Err > 0 Then
errmsg = MsgBox("代号:"& Err, vbOKOnly+VbExclamation,"过程执行出错")
Err.Clear
End If
If doCiv4Reg <> 1 Then
nofind = MsgBox("冇揾到 Civilization4.exe", vbOKOnly+VbExclamation,"放错目录?")
wscript.quit
End If
dim showtext
If RegCiv4Ok = 1 and doCiv4Reg = 1 Then
showtext = showtext & "文明4恢复" & chr(13) & chr (10)
else
if RegCiv4Ok <> 1 and doCiv4Reg = 1 then
showtext = showtext & "文明4恢复出错" & chr(13) & chr (10)
end if
End If
If RegCiv4BTSOk = 1 and doCiv4BTSReg = 1 Then
showtext = showtext & "BTS恢复" & chr(13) & chr (10)
else
if RegCiv4BTSOk <> 1 and doCiv4BTSReg = 1 then
showtext = showtext & "BTS恢复出错" & chr(13) & chr (10)
end if
End If
If RegCiv4WarlordOk = 1 and doCiv4WarlordReg = 1 Then
if WarlordsJ = 1 then
showtext = showtext & "Warlord恢复" & chr(13) & chr (10)
else
if WarlordsJ = 2 then
showtext = showtext & "Warlord(J)恢复" & chr(13) & chr (10)
end if
end if
else
if RegCiv4WarlordOk <> 1 and doCiv4WarlordReg = 1 then
showtext = showtext & "Warlord恢复出错" & chr(13) & chr (10)
end if
End If
endmsg1 = MsgBox(showtext, vbOKOnly+VbInformation, "结果")
用vbs修复文明4的注册表
这是一段VBS代码,用于修复文明4和各个资料片的注册表,包括版本Civ4 1.74,Warlords 2.13,BTS 3.13,3.19,自动判断是否装了汉化包。
《用vbs修复文明4的注册表》有0个评分
★★★★★
★★★★
★★★
★★
★