# system

Definition: | system(string st, integer mode=2)
Description: | Pass a command string st to the operating system command interpreter.
pwa/p2js: | Not supported.
Comments: | The system() routine is in fact a simple wrapper for system_exec(st,12), the mode of 12 starting a new shell (#04) and not waiting for a return value (#08), as explained in more detail in that documentation. The input mode parameter is completely ignored, as fullscreen DOS video modes have not been officially supported since the release (in Jan 2007) of Windows Vista. NOTE: Specifying a windows GUI app can sometimes appear to hang the console. Typically what has actually happened is that the shell has finished, but remains visible and unresponsive until the app terminates. In such cases, try using `{} = system_exec(st,8)` instead. You can use Phix as a sophisticated batch language by making calls to system() and system_exec(). system() will start a new DOS or Linux shell. system() allows you to use command-line redirection of standard input and output in the command string st.
Example 1: |
    system(`copy temp.txt a:\temp.bak`, 2)
Example 2: |
    system(`p.exe \test\myprog.ex < indata > outdata`, 2)
    -- executes myprog by redirecting standard input and output
Implementation: | See builtins\syswait.ew (an autoinclude) for details of the actual implementation.
See Also: | system_open, system_exec, dir, current_dir, getenv, command_line, get_interpreter