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 Statement Details
◄Summary► ◄Details► ◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
SHELL [commandstring$]
Usage Notes
■ SHELL with no commandstring$ gives you a new shell (COMMAND.COM.) You
then can enter operating-system commands at the prompt. Use the EXIT
command to return to Visual Basic.
■ Any .COM file, .EXE file, .BAT program, or MS-DOS command that runs
under the SHELL statement is called a "child process." Child processes
are executed by the SHELL statement, which loads and runs a copy of
COMMAND.COM with the /C option.
■ The /C option allows any parameters in commandstring$ to be passed
to the child process. It also allows redirection of standard input
and output, and execution of built-in commands such as DIR and PATH.
■ The program name in commandstring$ can have any extension you wish. If
no extension is supplied, COMMAND.COM looks for a .COM file, then an
.EXE file, and finally, a .BAT file. If COMMAND.COM is not found, SHELL
issues the error message, "File not found." Visual Basic does not
generate an error if COMMAND.COM cannot find the file specified in
commandstring$, but the operating system will generate an error message.
■ COMMAND.COM treats any text separated from the program name by at least
one blank as a program parameter.
■ Visual Basic remains in memory while the child process is running. When
the child process finishes, Visual Basic continues.