sysArg

Category: System

Syntax:

sysArg:String(index:Int)


Parameters

Returns

String



Summary

Returns one argument from the command line: 1 is the first after the program's name, 0 the program itself.

sysArg(1) to sysArg(sysArgCount()) are the arguments after the program's name, split by the shell: spaces separate them, and quotes keep one that has spaces in it whole and are taken off. sysArg(0) is the program's own path. Any other index gives "".

So ./MyTool "level 1.txt" -fast has sysArgCount() 2, sysArg(1) level 1.txt and sysArg(2) -fast.

View detailed documentation online



Example
UseConsole
Import "BBRuntime64.decls"

Function Main()
    If sysArgCount() = 0 Then
        Print "Usage: MyTool <file>"
    Else
        Print "Opening " & sysArg(1)
    EndIf
    Return False
EndFunction

BambooBasic © 2026 Michael Denathorn