Using the command line compiler


The command line compiler is located in the subdirectory 'Compilers\' from the SpiderBasic folder. The easier way to access this is to add this directory in the windows PATH variable, which will give access to all the commands of this directory at all times. The Linux/OS X switches equivalent are also accepted on Windows to ease script creation across all plateforms.

Command switches

/? (-h, --help): display a quick help about the compiler.

/COMMENTED (-c, --commented): create a commented javascript output file.

/DEBUGGER (-d, --debugger): enable the debugger support.

/OUTPUT (-o, --output) "filename": output name for the created web, iOS or Android app.

/JAVASCRIPT (-js, --javascript) "filename.js": name of the created javascript file.

/LIBRARYPATH (-lp, --librarypath) "path": path of the SpiderBasic dependencies.

/COPYLIBRARIES (-cl, --copylibraries) "path": copy the SpiderBasic dependencies to the specified local path.

/RESOURCEDIRECTORY (-rd, --resourcedirectory) "path": the directory where all the app resources are located.

/OPTIMIZEJS (-z, --optimizejs): creates an optimized javascript output, including needed javascript. A recent Java JRE needs to be installed to have this option working. The most recent JRE version can be found here:

/ICON (-n, --icon) \"filename.png\": icon to display in the browser tab. Has to be in PNG image format.
/APPNAME (-an, --appname): set the app name.

/APPVERSION (-av, --appversion): set the app version.

/APPPERMISSION (-ap, --apppermission) "permission": add a permission to the app (it can be specified several time). Available permissions:
- geolocation: add GPS access and other location API support to the app.

/STARTUPIMAGE (-si, --startupimage) "image.png": set the startup image to use when launching the app (iOS and Android only)

/PACKAGEID (-pi, --packageid) "com.yourcompany.appid": set the package id for the app (iOS and Android only)

/IAPKEY (-ik, --iapkey) "MIIB......AQAB": set InAppPurchase API key for the Android app

/DEPLOY (-p, --deploy): automatically deploy the app on USB connected device (iOS and Android only)

/FULLSCREEN (-fs, --fullscreen): activate fullscreen mode for the app (iOS and Android only)

/ORIENTATION (-w, --orientation) "orientation": set the app orientation (iOS and Android only):
- "any": the app can be in landscape or portrait mode, depending of the device orientation (default).
- "portrait": the app will always launch in portait mode.
- "landscape": the app will always launch in landscape mode.

/ANDROID: create an Android app (Windows only).

/JDK "jdk path": set the path to full JDK 1.8+ used to build Android app (Windows only).

/RESIDENT (-r, --resident) "filename": create a resident file specified by the filename.

/QUIET (-q, --quiet): Disable all unnecessary text output, very useful when using another editor.

/STANDBY (-sb, --standby): Loads the compiler in memory and wait for external commands (editor, scripts...). More information about using this flag is available in the file 'CompilerInterface.txt' from the SpiderBasic 'SDK' directory.

/IGNORERESIDENT (-ir, --ignoreresident) "Filename" : Doesn't load the specified resident file when the compiler starts. It's mostly useful when updating a resident which already exists, so it won't load it.

/CONSTANT (-t, --constant) Name=Value: Creates the specified constant with the given expression. Example: 'sbcompiler /CONSTANT MyConstant=10'. The constant #MyConstant will be created on the fly with a value of 10 before the program gets compiled.

/SUBSYSTEM (-s, --subsystem) "Name": Uses the specific subsystem to replace a set of internal functions. For more information, see subsystems.

/CHECK (-k, --check) : Check the syntax only, doesn't create or launch the executable.

/PREPROCESS (-pp, --preprocess) "Filename": Preprocess the source code and write the output in the specified "Filename". The processed file is a single file with all macro expanded, compiler directive handled and multiline resolved. This allows an easier parsing of a SpiderBasic source file, as all is expanded and is available in a flat file format. No comments are included by default, but the flag /COMMENTED can be used to have all untouched original source as comments and allow comments processing. The preprocessed file can be recompiled as any other SpiderBasic source file to create the final output.

/LANGUAGE (-g, --language) "Language": uses the specified language for the compiler.

/VERBOSE (-vb, --verbose): Displays more information when creating an app.

/VERSION (-v, --version): Displays the compiler version.


  CLI> sbcompiler /OUTPUT "test.html"
The compiler will compile the source code to test.html.

  CLI> sbcompiler /DEBUGGER /OUTPUT "test.html"
The compiler will compile the source code to test.html with debugger support.