Owl Magic

WinBatch® Hints

Getting Started with WinBatch Scripting


How do I install WinBatch / WinBatch+Compiler?

  • Once you purchase the software, you will be emailed a license ID and NUM. Be sure to have this information handy for the install.
  • Download the .zip file and save to a local drive: https://www.winbatch.com/download.html
  • Unzip the .zip file to a new ( empty ) directory.
  • Once unzipped, locate and run the SETUP.EXE.
  • Follow the install prompts. Note: It is highly recommended to install to the default ( Program Files (x86) and/or Program Files) directory(ies).

At the end of the install WinBatch Navigator will be launched. This is a great place to get started using WinBatch. The [License Info] button can be used to license WinBatch+Compiler.

[ Back to Top ]


Am I installed correctly?

From the Start Menu button, select All Programs. Do you see a shortcut for WinBatch? Try running WinBatch.exe to launch the WinBatch Navigator. Check that the version number is correct. If successful, you're probably installed correctly. If an incorrect version is installed, re-install the software.

[ Back to Top ]


How do I license WinBatch+Compiler?

Use the WinBatch Navigator to license the software.

  • When you complete your purchase of the software, your order confirmation will contain a License ID and NUM. We will also email you a copy. Be sure to have this information handy for this licensing procedure.
  • From the Windows Start Menu, select All Programs | WinBatch and run WinBatch.exe. This will launch the WinBatch Navigator.
    • Sometimes, you will see a prompt stating that you are running an "unlicensed evaluation copy" of WinBatch. If this message appears select the [Enter License Info] button to enter your License ID and NUM.
    • Otherwise, WinBatch Navigator will be launched. In this case, click on the [License Info] button in the lower left corner. In the small dialog box that appears, click the [Enter New License Numbers] button. You are now ready to begin entering your License ID and NUM.
  • In the "Registration ID" field, enter your License ID. It is generally a 6-digit number ( i.e. 823456 ).
  • In the "Control Number" field, enter your 16-alphanumeric License NUM ( i.e. CN01-29*P...etc. ). Note: This field is NOT case-sensitive.
  • Press OK.
  • You may be prompted for a Licensee Name. Enter the name of the licensee. Note: This can be any name you would like.
  • Press OK.
  • You should see a message stating "Thank you for your support."
  • If you get a message stating 'Invalid licensing Data' then start this process over from the beginning.

For the WinBatch compiler you will be asked to enter the License ID and NUM, the first time the WBCompiler.exe is launched.

  • From the Windows Start Menu, select All Programs | WinBatch and run WBCompiler.exe.
  • In the "Registration ID" field, enter your License ID. It is generally a 6-digit number ( i.e. 823456 ).
  • In the "Control Number" field, enter your 16-alphanumeric License NUM ( i.e. CN01-29*P...etc. ). Note: This field is NOT case-sensitive.
  • Press OK.
  • You should see a message stating "Thank you for your support."
  • If you get a message stating 'Invalid licensing Data' then start this process over from the beginning.

[ Back to Top ]


Is the software licensed and when does my eligibility for free updates expire?

From the Windows Start Menu, select All Programs | WinBatch and run WinBatch.exe. This will launch the WinBatch Navigator.

Click on the [License Info] button in the lower left corner. In the small dialog box that appears, you should see your product and it's free update expiration date.

[ Back to Top ]


Why so many help files?

Don't worry, they're mostly for reference. All of the current help files have the file extension .chm and are located in your WinBatch directory. You may have all or some of the following:

  • Consolidated WIL Help File: We offer several different help files depending on what is installed on the system. The Consolidated WIL Help file acts as a single resource for many of the various help files. It combines multiple .chm ( help ) files at run time, allowing them to all be consolidated into a single Help system. So, as you install some new product ( i.e. WIL Extenders) you will see them show up in the table of contents of this help file. This help file can be accessed from the Windows Start menu ( Start | All Programs | WinBatch | ConsolidatedWIL chm ) or from WinBatch Studio's context menu by clicking the right mouse button anywhere within an open file.
  • Windows Interface Language Help File: Contains syntax for the majority of the commands and the tutorial.
  • WinBatch Help File: Contains basic information on installation, info on additional utilities, WinBatch only commands.
  • WebBatch Help File: Contains basic information on installation, info on additional utilities, WebBatch only commands.
  • Extender Help Files: Contains syntax for extender specific commands. Note: These help files will only show up when you install an extender.

[ Back to Top ]


WIL vs. WinBatch, what's the difference?

WIL, the Windows Interface Language, is a powerful programming language for creating batch scripts. WinBatch is the interpreter which utilizes the WIL language.

[ Back to Top ]


Where are the executables located once installed?

All Exe's can be found in the WinBatch\System subdirectory.

[ Back to Top ]


WinBatch+Compiler options explained.

If you've got the WinBatch + Compiler, these are your Compile Options.

  • Large EXE for Standalone PC's (includes Extender DLLs, Other Files, etc.): Creates an EXE designed for standalone PC's and does not require manual installation of any extra DLLs. The EXTENDERS button displays a list of extenders which can be selected and compiled into a Standalone EXE option.
  • Small EXE for Networked PC's (without files): With this model, the WinBatch DLLs and any extender DLLs must be manually placed in a directory on the path or search drive. This option is suitable for network file server installation, or for distribution with separate DLL files.
  • Encode for Call's from EXE files: Creates an encoded .WBT file, with file extension .WBC, which protects source code from unauthorized or accidental modification. A compiled WinBatch EXE file is needed to launch the encoded file.
  • Encrypted with Password: Encrypts a .WBT file with a default Target extension of .WBE. The WinBatch interpreter, (WinBatch.exe), or a compiled WinBatch script is needed to access the encrypted file. Compile procedure will prompt for a password which must later be supplied when the WBE file is run.

[ Back to Top ]


WIL Extenders explained.

We offer over 20 free add-on WIL Extenders.

Check our website for the latest available extenders: https://www.winbatch.com/download.html#dlwilextenders.

Steps to install an individual WIL Extender:

  • Download the WIL Extender .zip file and save to a local drive.
  • Unzip the .zip file to a new ( empty ) directory.
  • Once unzipped, locate and run the SETUP.WBT.
  • Follow the install prompts.
  • The help file for this WIL Extender will automatically be added to the Consolidated WIL Help file ( ConsolidatedWIL.chm ).

You can easily install ALL of the extenders using the vCheck ( Extender Version Checker and Download Utility ) tool offered on the download page: vCheck

Keep in mind that vCheck requires:

  • WinBatch already installed.
  • WinInet extender installed.
  • Zipper extender installed.

Once a WIL Extender is installed, accessing the additional functionality available in WIL Extender Dlls is simple. At the top of each script in which WIL Extender commands are to be used add the appropriate extender with the AddExtender command.

AddExtender( filename [,version [, alternate filename ] ] )

The WIL interpreter will search for the extender DLLs. If no path is specified in the AddExtender statement, the WIL interpreter will search the current directory, the windows directory and directories on the path. The extender DLLs must be available or the AddExtender line will return an error. In general, when running a large EXE with embedded extenders, it will extract the extenders to the same directory the compiled EXE is in.

The AddExtender function should only be executed once for each extender dll in each WIL script that requires it. Each extender dll requires it's own AddExtender statement.

[ Back to Top ]


Tech Support Resources

  • WinBatch Forum: https://forum.winbatch.com
  • Technical Support Database: comprised of articles and examples https://techsupt.winbatch.com.
  • Tutorial: See the Windows Interface Language.chm file.  Go to Start | All Programs | WinBatch | ConsolidatedWIL chm and click on the 'Tutorial' link.

[ Back to Top ]


Passing Command line Parameters

A command like this runs a WinBatch system utility from a command line or an icon:

WinBatch.exe filename.wbt param1 param2.. param9

For more information see the WinBatch Help file, WinBatch.chm, or our online Technical Support Database.

[ Back to Top ]


What utilities are included?

  • WinBatch Studio: Text editor for color coding and debugging of WinBatch scripts.
  • Debug tool: Available as a feature of WinBatch Studio.
  • Debug /DebugTrace functions: see the Windows Interface Language.chm file.
  • WIL Dialog Editor: Creates dialog boxes.
  • PopMenu: Adds menu items and scripts to the Systray, on the task bar.
  • FileMenu: Adds menu items and scripts to the right-click drop down menu of the Windows Explorer.
  • WinInfo: Displays coordinates of a window.
  • Browser: Binary file viewer.
  • WIL Type Viewer: The WIL Type Viewer is a WinBatch development tool that assists you in writing Component Object Model (COM) Automation based WIL scripts. The viewer can be used to examine the type information details of properties, methods, and events associated with an individual COM object or interfaces, enumerations, and classes defined in type libraries.
  • RoboScripter: Script generator used to create Control Manager Extender based scripts.
  • WinMacro: Keystroke and mouse activity recorder and script generator.

[ Back to Top ]


List of Extension types associated with WinBatch.

  • .WBT: Standard WinBatch script file extension
  • .EXE: Compiled Standalone EXE
  • .MNW: Context menu file for PopMenu and FileMenu
  • .MNU: Context menu file for WinBatch Studio
  • .WBC: Compiled and encoded WBT file to be "CALL'ed" from an EXE
  • .CMP: Configuration file for each source file which is compiled
  • .CLR: Syntax color customization files for WinBatch Studio
  • .EXT: Configuration file for Compiler for Extenders

On Windows Vista and newer...one of the requirements that User Account Control (UAC) puts on developers is that you must mark your applications with a 'manifest' to declare if the application should run elevated or not. This can complicate matters when trying to develop and debug scripts using WinBatch, WinBatch+Compiler and WinBatch Studio. We have made available various WinBatch tools with all the possible manifest setting combinations. You can also give your WinBatch script a special file extension, and WinBatch will run the appropriately manifested version of WinBatch. See the "Manifests" topic in the Consolidated WIL Help File ( ConsolidatedWIL.chm ) for details.

32-bit

File Extension Tool Requested Execution Level uiAccess
.WBT WinBatch.exe highestAvailable true
.WBT_AF WinBatch_AF.EXE requireAdministrator false
.WBT_AT WinBatch_AT.EXE requireAdministrator true
.WBT_HF WinBatch_HF.EXE highestAvailable false
.WBT_HT WinBatch_HT.EXE highestAvailable true
.WBT_IF WinBatch_IF.EXE asInvoker false
.WBT_IT WinBatch_IT.EXE asInvoker true
.WBT_NN WinBatch_NN.EXE Un-manifested Un-manifested

64-bit

File Extension Tool Requested Execution Level uiAccess
.WBT64 WinBatch.exe highestAvailable true
.WBT64_AF WinBatch_AF.EXE requireAdministrator false
.WBT64_AT WinBatch_AT.EXE requireAdministrator true
.WBT64_HF WinBatch_HF.EXE highestAvailable false
.WBT64_HT WinBatch_HT.EXE highestAvailable true
.WBT64_IF WinBatch_IF.EXE asInvoker false
.WBT64_IT WinBatch_IT.EXE asInvoker true
.WBT64_NN WinBatch_NN.EXE Un-manifested Un-manifested

[ Back to Top ]


If statements explained.

Note: The different forms of the if statement must be used as the examples indicate. Changes in formatting may cause them to be unrecognized.

if ... endif (structured):

if expression
series
of
statements
endif

If ... else ... endif (structured):

if expression
series
of
statements
else
series
of
statements
endif

if...elseif...else...endif:

if expression
series
of
statements
elseif expression
series
of
statements
else
series
of
statements
endif

If ... then (single statement):

if expression then statement

if ... then ... else ...(single statement):

if expression then statement
else statement

[ Back to Top ]


Arrays explained.

Arrays are created using the new ArrDimension function. An array may have from 1 to 5 dimensions, and Arrays can now contain at least 10 million total elements, although this may be constrained by available memory. Array elements are referenced with their subscripts enclosed in square brackets. If an array has more than one dimension, the subscripts are separated with commas.

arrayvar[1]
arrayvar[1, 1]
arrayvar[0, 5, 2]

Array subscripts are 0-based. i.e., the first element in an array is array[0].

Array elements can contain any type of WIL value: string, integer, float, etc. You can have different types of values within an array.

You may not pass an array as a parameter to a WIL function (except for functions which state they accept an array), or use it in any sort of operation.

For example:

Message("Value is", arrayvar) ; NOT legal

On the other hand, the following are all supported:

arrayvar[0] = 5
x = arrayvar[0]
Message("Value is", arrayvar[0])
arrayvar = 5 ; Redefines the array to integer type variable
x = arrayvar ; Creates a second variable that points to the array

You can pass arrays to user-defined functions, and you can return arrays with the Return command.

When you pass an array name ( i.e., not an array element ) as a parameter to a function, the array gets passed "by reference". That is, the function receives a pointer to the array, and is therefore able to make changes to it "in place". This is similar to passing a binary buffer handle to a function, where the function is then able to make wholesale changes to the binary buffer.

In contrast, passing an array element ( i.e., with a subscript ) to a function is like passing a regular string or integer parameter to a function -- it gets passed "by value". i.e., the function receives the value of the array element, but is not able to modify the array itself. By the same token, when you pass a string to a function like StrUpper:

newstring = StrUpper(oldstring)

The function does not modify the variable "oldstring" at all. If you want to modify the existing variable, you can assign to it the return value of the function, eg:

mystring = StrUpper(mystring)
array[2] = StrUpper(array[2])

Row Major Format

Multidimensional arrays in WinBatch use the 'Row Major' format. When you specify a subscript for a multidimensional array, you need to first specify the row index then the column index. For Example:

arrMyArray[ row_index , column_index ]

In computing, row-major order describes the method used for storing multidimensional arrays in linear memory. In WinBatch, rows are identified by the first index of a two-dimensional array and columns by the second index. Array layout is critical for correctly passing arrays between programs written in different languages.

[ Back to Top ]


List of frequently used functions.

Check out our list of frequently used and extremely handy functions.

[ Back to Top ]