COMMAND$ function
Purpose: COMMAND$ returns the command line tail, that is, a character string containing everything typed on the command line after the filename that started the program.
Syntax 1: RetStr$ = COMMAND$ Parameters:
|
Example:
DIM RetStr$ RetStr$ = COMMAND$ PRINT RetStr$
Syntax 2: RetStr$ = COMMAND$(ArgCount%) Parameters:
|
Example:
DIM
cmd$DIM
iAS
INTEGER
cmd$=
COMMAND$
"Full command tail: ["
, cmd$,"]"
"The executable name is ["
,COMMAND$
(
0
)
,"]"
i=
1
cmd$=
COMMAND$
(
i)
WHILE
cmd$ <>""
"Argument"
, i," is ["
, cmd$,"]"
i+
+
cmd$=
COMMAND$
(
i)
WEND
"Total arguments:"
, i-
1
Using COMMAND$ to detect drag and dropped files
COMMAND$ is drag and drop aware and can capture the path and name of a file that is drag and dropped or copied and pasted on to its executable.
The following example will capture the path\filename of any file dropped on it and show a Message Box with, and print to a file, the path\filename of the dropped file.
DIM Filename$ DIM A$ 'Use this to write to Current folder 'Filename$ = CurDir$ &"\TestFile.txt" 'Use this to write to exe folder Filename$ = APPEXEPATH$ &"TestFile.txt" OPEN Filename$ FOR APPEND AS FP1 A$ = COMMAND$ MSGBOX A$ FPRINT FP1, A$ CLOSE FP1
BCX Console Sample Programs using statement function.
S06.bas, S44.bas, S47.bas, S48.bas, S64.bas, S65.bas, S67.bas, S68.bas, S71.bas, S73.bas, S74.bas, S77.bas, S96.bas, S98.bas, S103.bas, S105.bas, S141.bas,