GLBasic User Manual

Main sections

GETCOMMANDLINE$()

dat$ = GETCOMMANDLINE$()



Returns the parameters passed to the running program from the command line.

// --------------------------------- //
// Project: GETCOMMANDLINE$()
// Start: Friday, March 28, 2003
// Compiler Version: 1.30328


line$ = GETCOMMANDLINE$()
PRINT line$, 0, 0

// Argumente zerstückeln / Split arguments
DIM args$[100]
lastgood=0
isgood=FALSE
line$=" "+line$+" "
FOR p=0 TO LEN(line$)
c$ = MID$(line$, p, 1)
IF isgood
IF c$=" "
args$[narg]=MID$(line$, lastgood, p-lastgood)
narg=narg+1
isgood=FALSE
ENDIF
ELSE
IF c$<>" "
lastgood=p
isgood=TRUE
ENDIF
ENDIF
NEXT

// Argumente Zeigen / show arguments
FOR i=0 TO narg-1
PRINT "''" + args$[i] +"''", 0, 50+16*i
NEXT
SHOWSCREEN
MOUSEWAIT


Note :

The first parameter will contain the filename, which (depending on the platform) can contain the full or a relative path to the program

See also...