17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

GW-BASIC <strong>User's</strong> Guide<br />

SHELL Statement<br />

Purpose:<br />

To load and execute another program or batch file. When the program finishes, control returns to<br />

the GW-BASIC program at the statement following the SHELL statement. A program executed<br />

under control of GW-BASIC is referred to as a child process.<br />

Syntax:<br />

SHELL [string]<br />

Comments:<br />

string is a valid string expression containing the name of a program to run and (optionally)<br />

command arguments.<br />

The program name in string may have any extension that MS-DOS COMMAND.COM supports.<br />

If no extension is supplied, COMMAND will look for a .COM file, then an .EXE file, and finally,<br />

a .BAT file. If none is found, SHELL will issue a "File not found" error.<br />

Any text separated from the program name by at least one blank space will be processed by<br />

COMMAND as program parameters.<br />

GW-BASIC remains in memory while the child process is running. When the child process<br />

finishes, GW-BASIC continues at the statement following the SHELL statement.<br />

SHELL with no string will go to MS-DOS. You may now do anything that COMMAND allows.<br />

When ready to return to GW-BASIC, type the MS-DOS command EXIT.<br />

Examples:<br />

SHELL<br />

A>DIR<br />

A>EXIT<br />

Write some data to be sorted, use SHELL SORT to sort it, then read the sorted data to write a<br />

report.<br />

10 OPEN "SORTIN.DAT" FOR OUTPUT AS #1<br />

20 'write data to be sorted<br />

.<br />

.<br />

.<br />

1000 CLOSE 1<br />

1010 SHELL "SORT SORTOUT.DAT"<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/SHELL.html (1 of 2)28/03/2004 21.29.24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!