OS_Shell

<< Click to Display Table of Contents >>

Navigation:  ThinBASIC Modules > OS (Operating System) >

OS_Shell

 

Description

 

Run an operating system command.

 

Syntax

 

pID = OS_Shell(Command[, WindowStyle[, Mode]])

 

Returns

 

Number.

 

When OS_Shell is executed in %OS_SHELL_ASYNC mode, it will return the process id of the executed command.

When OS_Shell is executed in %OS_SHELL_SYNC mode, it will return the executed application exit code. This is useful when executing Console applications that return code to signal error or status situations.

 

Parameters

 

Name

Type

Optional

Meaning

Command

String

No

Command string to execute along with and any required arguments or command-line switches.

WindowStyle

Number

Yes

A number corresponding to the style of the window in which the child process is to be executed.  If WndStyle is omitted, the program is opened normal with focus. See OS_Equates for possible values

Mode

Number

Yes

If present, it can assume one of two options:

%OS_SHELL_SYNC

the command will be executed and the script will wait for the command to finish

%OS_SHELL_ASYNC

the command will be executed and the script will immediatelly continue its execution

 

Remarks

 

Execution can be run in asynchronous or synchronous mode.

Under asynchronous mode, script continues uninterrupted while Command is executed.

Under synchronous mode, script will wait for Command execution.

 

Restrictions

 

See also

 

OS_ShellExecute

 

Examples