Menu

Command line arguments

Kalle
:::shell
v1 [options] <filename>

Options:

-l              Syntax check only (lint)
-o <file>       Append output to file
-r <code>       Run code without <?v1 ?> tags
-v              Show version
-w              Web mode (CGI)

Options only available on Windows:

:::shell
-b              Run in background (hide window)
-p <priority>   Process priority: -2=IDLE .. 0=Normal .. 3=Realtime

Run file on command line:

:::shell
v1 filename.v1 [arguments]

Working with command line arguments in V1:

V1 has a global Array 'argv' which contain the arguments.

:::php
<?v1 
print (count (argv).' arguments available');
arg1 = argv[0]; // Always the complete filename of v1.exe e.g. c:\projects\v1\v1.exe
arg2 = argv[1]; // Filename of the V1 script e.g. filename.v1
arg3 = argv[2]; // First user defined argument
?>

Rund code on command line with -r option:

:::shell
v1 -r "print('Its now '.date('%D %j %F %Y %H:%i:%s'));"
Its now Wed 2 May 2018 11:13:54

The Web mode -w option:

Use -w option to start V1 as CGI interpreter on a Webserver.
Therefore you have to configurate your Webserver to call v1 -w <filename> for every file which should be interpretated with V1.
See also chapter Web mode.

back to Home