COMMAND$
From QB64 Wiki
The COMMAND$ function returns the DOS commandline arguments passed when a program is run.
Syntax: variable$ = COMMAND$
- The string return value is any parameter following the filename in a RUN or command line statement.
- Qbasic returns uppercase STRING parameters no matter what case they were sent originally.
- QB64 does not require or return all uppercase values so keep that fact in mind when checking parameters passed!
- Useful when the programmer wants to add options to the command line of a program for later use by another program.
- COMMAND$ was not available in QuickBasic versions below 4.0
Example: Compile both programs. ProgramA RUNs ProgramB with a parameter passed following the filename:
LOCATE 12, 36: PRINT "ProgramA" LOCATE 23, 25: PRINT "Press any key to run ProgramB" K$ = INPUT$(1) RUN "ProgramB FS" 'pass FS parameter to ProgramB in QB64 END
- ProgramB checks for fullscreen parameter pass in QB64 and goes full screen.
LOCATE 12, 36: PRINT "ProgramB" parameter$ = UCASE$(COMMAND$) LOCATE 20, 33: PRINT "Parameter = " + parameter$ IF LEFT$(parameter$, 2) = "FS" THEN _FULLSCREEN 'parameter changes to full screen END
Parameter = FS.EXE
See also: