Batch Compile

 

WinBatch+Compiler supports the following command line for ‘batch compilation' of WinBatch scripts:

 

32-bit

"C:\Program Files (x86)\WinBatch\System\WBCompiler.exe" "C:\WBProjects\Test.cmplist"

 

64-bit

"C:\Program Files\WinBatch\System\WBCompiler.exe" "C:\WBProjects\Test.cmplist"

 

A batch compile does require a little setup in order to work.  

First you must have .CMP file for each script you want to compile. A .CMP file is a configuration file that contains all the compile options used.  A .CMP file automatically gets generated each time you successfully compile any script.  The .WBT source file must be located in the same directory as the .CMP file.

The format of the .CMP file is as follows:

 

[Main]

Type=1

Src=test1.wbt

Targ=C:\WBProjects\test1.exe

Icon=

CmpVersion=4

[Options]

TechWebPage=

UACManifestSelection=highestAvailable

UACManifestUI=false

CodeSign=0

CodeSignDetails=WWWTEST~~

RunHidden=0

LargeExtractDest=0

PreventAutoExtract=0

[Version Info]

Comments=

CompanyName=Wilson WindowWare Inc

FileDescription=test3

FileVersion=1.0

InternalName=test3.exe

LegalCopyright=Wilson WindowWare Inc

LegalTrademarks=

OriginalFilename=test3.exe

ProductName=test3

ProductVersion=1.0

[Other Files]

Count = 2

File001 = C:\sample1.txt

File002 = C:\sample2.txt

[Extenders]

Count =  2

File001 = wwctl44i.dll

File002 =  wwwnt34i.dll

 

 

Note: You could feasibly create a .CMP file on the fly. The internal format of the .CMP file is the same as .INI files. You can use all of the WinBatch IniXXXPvt() functions to manage these files.

 

CMP file format explained:

 

 

WinBatch+Compiler

Compiler Usage

How the Compiler Works

Compiler Installation

Command Line Parameters

 

 

[MAIN]

Type = [REQUIRED] Compile option. ( 1 = Large, 2 = Small )

Source = [REQUIRED] Name of the source code file (.WBT or .WIL) to compile.

Target = [REQUIRED] Name of the exe file to create.

Icon = Path to icon filename.

CmpVersion = Version of CMP file. ( Subject to change in future versions of WinBatch. )

 

[OPTIONS]

TechWebPage = URL to be displayed in WinBatch error messages. ( http://www.example.com )

UACManifestSelection = Requested Execution Level. ( "highestAvailable", "asInvoker", "requireAdministrator" )

UACManifestUI = Manifest uiAccess. ( "true" or "false" )

CodeSign = Code sign settings. ( 1 = true , 0 = false )

CodeSignDetails = Code signing certificates friendly-name. ( WWWTEST )

RunHidden = Hides the EXEs icon on the task bar. ( 1 = "true" , 0 = "false" )

LargeExtractDest = Force the EXE to extract the files to the removable drive. ( 1 = true, 0 = false )

PreventAutoExtract = Prevent extract of Extender and Other files. ( 1 = true, 0 = false )

 

[Version Info]

Comments = Any Comments about the EXE ( "My Test EXE")

CompanyName = Company name. ( "Wilson WindowWare Inc" )

FileDescription = Description of EXE. ( test1 )

FileVersion = File version number of the EXE ( 1.0 )

InternalName = Name of the EXE file. ( test1.exe )

LegalCopyright = Copyright info. ( "Wilson WindowWare Inc" )

LegalTrademarks = Trademark info. ( "WinBatch is a registered trademark of Wilson WindowWare Inc" )

OriginalFilename = Name of the EXE file. ( test1.exe )

ProductName = Product name of the EXE file. ( test1 )

ProductVersion = Product version of the EXE file. ( 1.0 )

 

[Other Files]

Count = total number of other files included. ( 2 )

File001 = Path of the 'Other file' to include in the compile. ( C:\sample1.txt )

File002 = Path of the 'Other file' to include in the compile. ( C:\sample2.txt )

Etc…

 

[Extenders]

Count = total number of Extender files included. ( 2 )

File001 = 'Extender' file to include in the compile. ( wwctl44i.dll )

File002 = "Extender' file to include in the compile. ( wwwnt34i.dll )

Etc…

 

 

You will then need to create a specially formatted file with the file extension of .CMPLIST.

For Example:

C:\WBProjects\Test.cmplist

 

The .CMPLIST file must include a single line that contains the full path to the .CMP ( configuration ) files for *each* script you would like to batch compile.

For Example:

C:\WBProjects\test1.cmp

C:\WBProjects\test2.cmp

C:\WBProjects\test3.cmp

 

Notes:

  • You *must* specify a full file path to each .CMP file in the .CMPLIST file.

  • Ideally you should put all these .CMP files into a single ‘Project’ directory. However you can specify paths to all the various .CMP files regardless of the directory.

Now that you have successfully created a .CMP file for each script and also created a .CMPLIST file, you can create your ‘Batch Compile’ script.  

For Example:

 

;BatchCompile.wbt

wbcompiler = ‘C:\Program Files (x86)\WinBatch\System\WBCompiler.exe’

cmplistfile = ‘C:\WBProjects\Test.cmplist’

Run( wbcompiler, cmplistfile )

exit

 

IMPORTANT:

  • The .CMP files information must be correct or this compile process will fail.

  • The .WBT source file must be located in the same directory as the .CMP file.

  • The .CMPLIST files information must be correct or this compile process will fail.