Any program on a disk can be run as a command, by typing its name (see Running Programs). BASIC-DOS supports two kinds of external commands:
If no extension is specified, BASIC-DOS looks for a COM, EXE, BAT, and BAS file, in that order.
A command’s arguments are passed as typed, except that an argument that’s a string variable is replaced by its value (eg, FORMAT D$ formats the drive in D$); see Command Arguments.
Many COM and EXE programs written for PC DOS 1.x and 2.x will work, as long as they don’t rely on features that BASIC-DOS doesn’t support (eg, TSR functions that allow a program to terminate-and-stay-resident). One key difference is that BASIC-DOS does not give COM programs all available memory. BASIC-DOS COM programs can specify a memory size, and non-BASIC-DOS programs only receive a portion of what’s available.
Also, when an executable runs, COMMAND.COM tries to release most of its own memory if no other session is using it, in which case the MEM command will report more memory available for EXEC vs. BASIC operations.
BAT and BAS files are text files containing BASIC-DOS commands and BASIC statements (see BASIC-DOS Programming). The differences between them are:
A BAT or BAS file can run other BAT or BAS files (no CALL command is required) and then continue; each nested BAS file gets its own variables. See Batch Files for how BASIC-DOS batch files differ from PC DOS batch files.
These are the programs provided with BASIC-DOS, each of which has a page of its own. COMMAND.COM is in the root directory of every BASIC-DOS disk, and the rest are in the EXT directory (see Running Programs for the layout of a BASIC-DOS disk).
ls commandsed commandEvery BASIC-DOS startup diskette also contains the system files BASDEV.COM (device drivers) and BASDOS.COM (the kernel), which are read-only hidden system files. These files must not be run.
Utilities that don’t need the speed of assembly language are BASIC programs, written in the style BASIC-DOS lists them in: every line indented with a tab, after a line number only where one is needed as a label. Their switches start with the switch character (/, unless SWITCHAR changes it, eg, to -), and when a required argument is missing or an argument isn’t valid (eg, an unknown switch), a utility displays Syntax error (use HELP to see a command’s usage). Like other commands, a utility that fails this way (or in any other way) sets ERRORLEVEL to 1, with END.
FIND, MORE, SED, SORT, TEE, TR, UNIQ, and WC are filters. A filter reads lines of input, which normally come from a pipe (eg, DIR | SORT) or a file (eg, SORT < NAMES.TXT), and writes the results to its output. FIND, MORE, SED, SORT, UNIQ, and WC also accept file names instead (FIND and WC accept more than one). Input ends when the pipe is closed, at the end of the file, or at a CTRL-Z, and a line longer than 254 characters is split.
Switches start with the switch character (/, or - if SWITCHAR is - or PATHCHAR is /). Their letters can be in upper or lower case, and can be combined (eg, FIND /IN BAS). Anything else after the switch character displays Syntax error, and sets ERRORLEVEL to 2.
Filters can be chained (eg, TYPE FILE | SORT | MORE), but every command after the first needs its own session, so a pipeline can’t have more commands than SESSIONS= allows, and a BAT or BAS file (which runs in the current session) can only be the first command (eg, LS | MORE, but not DIR | TEST.BAS, which reports Unable to open TEST.BAS). If any command of a pipeline fails (eg, it can’t be found, or there’s no session for it), the error is displayed, the commands already running are ended, and ERRORLEVEL is set to 1. And if a command stops reading its input early (eg, FIND can’t open its file), the command writing to it gets a write error instead of waiting forever; the filters stop when that happens.
SED’s addresses and s command, and FIND’s /R switch, use the regular expressions of the UNIX ed and sed commands of the 1970s and 1980s:
\ before any character makes it ordinary (eg, \., \*, \[, or \/ for SED’s delimiter). matches any character[chars] matches any one of the chars, which can include ranges (eg, [A-Za-z0-9]), and [^chars] matches any character that isn’t one of them; a ] first (eg, []x]) or a - first or last is ordinary, and so is \* after a character, ., or [chars] matches it zero or more times, as many as possible (eg, [0-9][0-9]* matches a number)^ at the start matches the start of the line, and $ at the end matches its end (elsewhere, they’re ordinary)\( and \) mark a group (up to 9), which the text of a SED s command can refer toAn empty regular expression in SED (eg, // or s//text/) reuses the previous one. The newer +, ?, |, and \{m,n\} aren’t supported.
Source: the UTILRE section of utilproc.inc
Copyright (c) 2020-2026 Jeff Parsons Released under MIT License