Jump to content

Execute a system command: Difference between revisions

No edit summary
Line 89:
 
=={{header|BBC BASIC}}==
On Acorn computers the *CAT command catalogues the current directory, the equivalent of the Unix ls command or the DOS/Windows dir command. The BBC BASIC OSCLI command passes a string to the Command Line Interpreter to execute a system command, it is the equivalent of C's system() command.
<lang bbcbasic>OSCLI *RUN dir"CAT"</lang>
 
With BBC BASIC for Windows you can execute the Windows dir command:
The BBC Microcomputers use a ROM based basic interpreter, so every statement within the program is a system command. If a command without a line number is typed, whilst the computer is in a ready state, the command gets executed immediately. There is no pause command, so in this example, we use the list command (which exhibits totally different behaviour to a pause command):
<lang bbcbasic>OSCLI "*dir":REM *dir to bypass BB4W's built-in dir command</lang>
 
And if running BBC BASIC on a Unix host, you can execute the ls command:
<lang basicbbcbasic>LISTOSCLI "ls"</lang>
 
{{works with|BBC BASIC for Windows}}
<lang bbcbasic> *RUN dir
*RUN pause
*RUN cmd.exe /c dir & pause</lang>
 
=={{header|Brat}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.