bas7ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
SHELL Function Programming Example
                       Example                 Contents  Index  Back
──────────────────────────────────────────────────────────────────────────────
'This example uses the SHELL function to execute three OS/2 commands.
 
CLS
ON ERROR GOTO ErrHandler
Ext$ = CHR$(34) + " EXE" + CHR$(34)
'The child process does: DIR | FIND " EXE" | SORT
Child$ = "dir | find " + Ext$ + " | sort"
ProcessID = SHELL(Child$)
PRINT "Process ID is: ProcessID"
END
 
ErrHandler:
    SELECT CASE ERR
        CASE 73
            PRINT : PRINT "You cannot use the SHELL function in DOS."
        CASE ELSE
    END SELECT
    END