#Include

 

This command gives you the ability to embed external WBT files when running or compiling a WinBatch script, by using the "#include" pre-processor directive.

The syntax is:

 

#include "filename"

 

Any of the following are permitted:

#include "filename" 

#include 'filename' 

#include `filename` 

#include filename 

 

Nothing else should appear on the line, including comments.

The file name may contain path information. If the 'include' command contains relative path information, the check begins relative to the current script's location. If the file is not found then a check is conducted relative to the current working directory. When both of those location fail then a standard Windows file search is performed. The standard Windows file search varies somewhat by location order depending on the OS version and a few registry settings. The locations are, however, the usual suspects as defined by Microsoft:

  • The directory from which the application loaded.

  • The system directory.

  • The 16-bit system directory.

  • The Windows directory.

  • The current directory.

  • The directories that are listed in the PATH environment variable.

Of course, if the file information is absolute then the absolute path is used to attempt to open the included file.

 

Each line containing a #include directive will be replaced by the contents of the specified WBT file. If the file cannot be found, an error will occur.

 

When using the WinBatch compiler, the "included" file(s) must be present at compile time; they will be embedded in the compiled EXE, and therefore do not need to be distributed as separate files.

When using the interpreted version of WinBatch, the "included" file(s) must be present at the point in time when the script is launched (they cannot be created "on-the-fly" from within the script).

You can have as many #include directives as you wish, and they may be nested (i.e., "included" files may themselves contain #include directives).

 

 

For Standalone (Large) EXE compile

For Compiles of Small EXE’S

For Compiles of Called WBT'S (Encode)

For Encrypted WinBatch WBT'S

 

Interactive Mode

WinBatch+Compiler