You can use notepad to create these scripts.
@Echo off
WScript %0\\..\\bring_down_the_sky.vbs
This is the contents of the batch file. You can name it whatever you want, as long as it has the .bat extension (example: Bring Down The Sky.bat). Make sure the batch file is in the same folder path as your Bring Down The Sky installer (like %userprofile%\\Downloads).
set oRegistry = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\default:StdRegProv")
const HKLM = &H80000002
sKeyPath = "SOFTWARE\\Wow6432Node\\Electronic Arts\\Electronic Arts\\Bring Down The Sky\\ergc"
oRegistry.CreateKey HKLM, sKeyPath
oRegistry.SetStringValue HKLM, sKeyPath, "", "PRODUCT KEY"
Set oCommand = WScript.CreateObject("WScript.Shell")
oCommand.Run("""%userprofile%\\Downloads\\Bring Down The Sky.exe""")
Set oWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2")
Do
Set oProcessCollection = oWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = 'Bring Down The Sky_code.exe'")
Loop Until oProcessCollection.Count = 1
For Each oProcess in oProcessCollection
oProcess.Terminate()
Next
This is the contents of the vbscript file. Make sure the vbscript file is in the same folder path as your Bring Down The Sky installer (like %userprofile%\\Downloads). The parts you need to edit are bolded:
PRODUCT KEY = Replace this with your Bring Down The Sky product key (without spaces and hyphens).
%userprofile%\\Downloads\\Bring Down The Sky.exe = Replace this with the full path name and extension of your Bring Down The Sky installer. If it's easier for you, you can just leave this alone, move the installer to the folder path listed (%userprofile%\\Downloads\\), and rename your installer (Bring Down The Sky.exe).
Make sure the quotes are still around the product key and installer path + name after your edits. It should be 1 set of quotes for the product key; 3 sets of quotes for the installer path + name. DO NOT EDIT ANYTHING ELSE IN THIS VBSCRIPT FILE UNLESS YOU KNOW WHAT YOU ARE DOING.
I highly recommend naming this vbscript file bring_down_the_sky.vbs (because batch files seem to be picky about spaces in file names). If you deviate from this file name, then you'll need to change it in the batch file as well.
**********
Make sure the batch file, vbscript file, and installer are all in the same folder path (like %userprofile%\\Downloads). Right click the batch file and run as administrator. The batch file will run the vbscript file, which in turn will write your product key to the registry. Afterwards, it will initiate your Bring Down The Sky installer. If you have any trouble with this, let me know.
Modifié par amcnow, 20 juin 2011 - 01:51 .