Command line arguments
Factor handbook > The implementation

Next:Running code on startup

Factor command line usage:
factor [VM args...] [script] [args...]

Zero or more VM arguments can be passed in, followed by an optional script file name. If the script file is specified, it will be run on startup using run-script. Any arguments after the script file are stored in the following variable, with no further processing by Factor itself:

Instead of running a script, it is also possible to run a vocabulary; this invokes the vocabulary's MAIN: word:
factor [system switches...] -run=<vocab name>

If no script file or -run= switch is specified, Factor will start The listener or UI developer tools, depending on the operating system.

As stated above, arguments in the first part of the command line, before the optional script name, are interpreted by to the Factor system. These arguments all start with a dash (-).

Switches can take one of the following three forms:
-foo - sets the global variable "foo" to t
-no-foo - sets the global variable "foo" to f
-foo=bar - sets the global variable "foo" to "bar"

Command line switches for the VM
Command line switches for bootstrap
Command line switches for general usage

The raw list of command line arguments can also be obtained and inspected directly:
(command-line) ( -- args )

There is a way to override the default vocabulary to run on startup, if no script name or -run switch is specified: